Reminder to self: for HttpWebRequest make sure you have your proxy setup correctly.
Monitoring HTTP Output with Fiddler in .NET HTTP Clients and WCF Proxies – Rick Strahl’s Web Log.
–jeroen
Posted by jpluimers on 2014/04/15
Reminder to self: for HttpWebRequest make sure you have your proxy setup correctly.
Monitoring HTTP Output with Fiddler in .NET HTTP Clients and WCF Proxies – Rick Strahl’s Web Log.
–jeroen
Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Fiddler, Software Development, Visual Studio 11, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Web Development | Leave a Comment »
Posted by jpluimers on 2013/12/25
StackOverflow user Joe (sorry, no last name) helped me big time by answering my question on Business logic shared by ASP.NET / WinForms: find the location of the assembly to access relative files to it.
Before showing the code at the bottom of this blog post, let me explain the question in more detail:
Basically I was in the midst of refactoring some ‘inherited’ business logic code that – before refactoring – for the ASP.NET side needs to be initialized with an absolute path, but on the WinForms / WPF side only with a relative path to a GetExecutingAssembly directory.
To ease xcopy deployment, I wanted all configuration settings to be relative. But I hadn’t found a common means for these platforms to obtain a directory usable as a root for accessing relative files.
That way I could put identical settings in both the Web.config and App.config, heck even generate them based on a common fragment, whithout having to hard-code absolute path names.
I knew about Assembly.GetExecutingAssembly, but in ASP.NET that location is not where the web site is (both IIS and the WebDevelopment server make use of temporary locations to store the assemblies).
ASP.NET does have Server.MapPath and HostingEnvironment.MapPath, but I didn’t want to make the business logic depend on ASP.NET.
Joe came up with this solution, which works dandy: Read the rest of this entry »
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, F#, Prism, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0, Web Development | Leave a Comment »
Posted by jpluimers on 2013/12/18
Thanks StackOverflow user splattne (Stefan Platnner) for explaining the differences between the various parameters you can pass to Server.MapPath, and giving some very clear examples.
You can also use it with HostingEnvironment.MapPath, which has the added benefit that it doesn’t require HttpContext (for more detail on it, see Working With HttpContext.Current).
–jeroen
via:
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2013/11/27
As of Visual Studio 2010 SP1 (I think it was there in the original non-SP1 version of VS2010), Microsoft has hidden the addition of classic ASCX webservices as they favour WCF over ASPX (there are quite a few differences).
It is easy to workaround though as Stack Overflow users User Cyberherbalist and User Alejandro Martin have shown, with a little bit post-editing from me: Read the rest of this entry »
Posted in .NET, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 4.0, C# 5.0, Development, SOAP/WebServices, Software Development, Visual Studio 11, Visual Studio 2010, Visual Studio and tools | Leave a Comment »
Posted by jpluimers on 2013/06/19
I hadn’t done Charting for a while, but these got going very quickly:
There are example downloads for ASP.NET and WinForms requiring .NET 4 or higher.
In addition, these starting points also proved to be really helpful:
Since my objective was adding charts to an existing WinForms business app, this was the namespace at hand: System.Windows.Forms.DataVisualization.Charting Namespace ().
If you are at .NET 3.5, then start at DataVisualization.Charting.Chart simple example – C# – Snipplr Social Snippet Repository.
–jeroen
Posted in .NET, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 3.0, C# 4.0, Development, Software Development, VB.NET, Visual Studio 2010, WinForms | Leave a Comment »
Posted by jpluimers on 2012/12/26
There is a lot of information in Assembly that is either internal or private. Luckily you van get an AssemblyName instance through Assembly.GetName() or Assembly.GetName(Boolean) which has quite a few public members that get initialized while calling the internal AssemblyName.Init method.
This is the member mapping of AssemblyName members to Assembly members:
| AssemblyName member | Assembly member |
| Name | GetSimpleName() *internal |
| GetPublicKey() | GetPublicKey() *internal |
| GetPublicKeyToken() | null |
| Version | GetVersion() *internal contains the AssemblyVersionAttribute of the assembly |
| CultureInfo | GetLocale() *internal |
| HashAlgorithm | GetHashAlgorithm() *private |
| VersionCompatibility | AssemblyVersionCompatibility.SameMachine |
| CodeBase | GetCodeBase(Bool) *internal |
| Flags | GetFlags() | AssemblyNameFlags.PublicKey |
| KeyPair | null |
| ProcessorArchitecture | complex set of calls |
–jeroen
Posted in .NET, .NET 3.5, .NET 4.5, ASP.NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2012/11/07
A while ago I needed to shorten SqlClient ConnectionStrings. One way to do that is to use the shortest Key for each property (and not use the default key names that are much longer).
I beefed up the code to show you both the shortest and all equivalent keys (a few of the Microsoft exams want you to memorize most of these).
The HTML table below (similar to the huge and therefore hard to read table on MSDN) comes directly from the C# code at the bottom of the post. The only post-editing I did was making the header row bold.
| Key | ShortesEquivalentKey | EquivalentKeys |
| Application Name | app | Application Name,app |
| ApplicationIntent | ApplicationIntent | ApplicationIntent |
| Asynchronous Processing | async | Asynchronous Processing,async |
| AttachDbFilename | AttachDbFilename | AttachDbFilename,extended properties,initial file name |
| Connect Timeout | timeout | Connect Timeout,connection timeout,timeout |
| Connection Reset | Connection Reset | Connection Reset |
| Context Connection | Context Connection | Context Connection |
| Current Language | language | Current Language,language |
| Data Source | addr | Data Source,addr,address,network address,server |
| Encrypt | Encrypt | Encrypt |
| Enlist | Enlist | Enlist |
| Failover Partner | Failover Partner | Failover Partner |
| Initial Catalog | database | Initial Catalog,database |
| Integrated Security | trusted_connection | Integrated Security,trusted_connection |
| Load Balance Timeout | connection lifetime | Load Balance Timeout,connection lifetime |
| Max Pool Size | Max Pool Size | Max Pool Size |
| Min Pool Size | Min Pool Size | Min Pool Size |
| MultipleActiveResultSets | MultipleActiveResultSets | MultipleActiveResultSets |
| MultiSubnetFailover | MultiSubnetFailover | MultiSubnetFailover |
| Network Library | net | Network Library,net,network |
| Packet Size | Packet Size | Packet Size |
| Password | pwd | Password,pwd |
| Persist Security Info | persistsecurityinfo | Persist Security Info,persistsecurityinfo |
| Pooling | Pooling | Pooling |
| Replication | Replication | Replication |
| Transaction Binding | Transaction Binding | Transaction Binding |
| TrustServerCertificate | TrustServerCertificate | TrustServerCertificate |
| Type System Version | Type System Version | Type System Version |
| User ID | uid | User ID,uid,user |
| User Instance | User Instance | User Instance |
| Workstation ID | wsid | Workstation ID,wsid |
The code below uses a few techniques referenced as StackOverflow links:
Both the main program and the SqlConnectionStringBuilderHelper class are less than 70 lines of code (each about 50 when excluding comments and empty lines).
The SqlConnectionStringBuilderHelper uses the internals of the SqlConnectionStringBuilder class (all DbConnectionStringBuilder descendants I have seen work in a similar way):
Related:
Persist Security Info: [WayBack] c# – Persist Security Info Property=true and Persist Security Info Property=false – Stack OverflowNetwork Library:
OLE DB Services:
Enjoy the code: Read the rest of this entry »
Posted in .NET, ASP.NET, C#, C# 3.0, C# 4.0, C# 5.0, CSV, Development, LINQ, Software Development | Leave a Comment »
Posted by jpluimers on 2012/10/17
While preparing for the Category Cloud series of posts, I found a lot of helpful links.
Here they are:
–jeroen
Posted in .NET, ASP.NET, C#, Development, HTML, Software Development, Web Development | Leave a Comment »
Posted by jpluimers on 2012/10/03
When moving a truckload of stuff from Visual Source Crash, I came a long many .webinfo files.
I wasn’t sure they should be in TFS, and indeed they should not:
.webinfo should be excluded. (Some info about webinfo: How to copy and configure ASP.NET projects between different local computers)
–jeroen
via: asp.net – Should the WebInfo file be excluded from SVN – Stack Overflow.
Posted in .NET, ASP.NET, Development, Software Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »
Posted by jpluimers on 2012/09/06
So I won’t forget: .NET Framework Libraries.
It contains the download links, setup instructions (for debugging, troubleshooting and source/symbols downloading) and licensing information.
–jeroen
Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, Development, Software Development | Leave a Comment »