We have several webservers that do not follow the correct RFC specification when performing some specific HTTP web requests, in order to communicate with them we need to enable unsafe header parsing. Changeing the webservers to respond correctly is NOT an option in our case.
According to documentation, adding the following lines to the app.config enables the unsafe header parsing.
<httpWebRequest useUnsafeHeaderParsing = "true"/>
This works nicely for regular applications, however, the problem is that our .NET code is exposed andÃÂ run as a COM object. And adding a .config file to .NET assemblies doesn't work, neither when being loaded by COM or if the .NET assembly is loaded and used from another .NET application.
Since the application that loads our .NET COM object isn't a .NET application it can not have it's own app.config file.
So how do I enable unsafe header parsing in code?
In .NET 1.1 the unsafe header parsing flag could be changed using reflection, however this flag does not appear to be in the same place in .NET 2.0.
View Complete Post