The server submitted a protocol violation. Section=responseheader DETAIL=CR back must be LF
The server committed a protocol violation. Section=responseheader DETAIL=CR must is followed by LF
The main meaning is that Microsoft does not tolerate a server response that does not conform to the provisions of RFC 822 that Httpheader must end with CRLF.
One solution is to add a application.config or Web. config file
<system.net>
<settings>
</settings>
</system.net>
Allow the system to tolerate (tolerant) hearder information that ends in CR or LF only
Using System.Reflection;
BOOLgetallowunsafeheaderparsing () {//Get The assembly that contains the internal classAssembly anetassembly = assembly.getassembly (typeof(System.Net.Configuration.SettingsSection)); if(anetassembly! =NULL) { //Use the assembly in order to get the internal type for//The internal classType Asettingstype = Anetassembly.gettype ("System.Net.Configuration.SettingsSectionInternal"); if(Asettingstype! =NULL) { //Use the internal static property to get an instance//of the internal settings class. If the static instance//isn ' t created allready the property would create it for us. ObjectAninstance = Asettingstype.invokemember (" Section", BindingFlags.Static|BindingFlags.GetProperty| BindingFlags.NonPublic,NULL,NULL,New Object[] { }); if(Aninstance! =NULL) { //Locate the private bool field that tells the//Framework is unsafe header parsing should be//allowed or notFieldInfo auseunsafeheaderparsing =Asettingstype.getfield ("useunsafeheaderparsing", BindingFlags.NonPublic|bindingflags.instance); if(Auseunsafeheaderparsing! =NULL) return(BOOL) Auseunsafeheaderparsing.getvalue (aninstance); } } } return false; } voidSetallowunsafeheaderparsing (BOOLval) { //Get The assembly that contains the internal classAssembly anetassembly = assembly.getassembly (typeof(System.Net.Configuration.SettingsSection)); if(anetassembly! =NULL) { //Use the assembly in order to get the internal type for//The internal classType Asettingstype = Anetassembly.gettype ("System.Net.Configuration.SettingsSectionInternal"); if(Asettingstype! =NULL) { //Use the internal static property to get an instance//of the internal settings class. If the static instance//isn ' t created allready the property would create it for us. ObjectAninstance = Asettingstype.invokemember (" Section", BindingFlags.Static|BindingFlags.GetProperty| BindingFlags.NonPublic,NULL,NULL,New Object[] { }); if(Aninstance! =NULL) { //Locate the private bool field that tells the//Framework is unsafe header parsing should be//allowed or notFieldInfo auseunsafeheaderparsing =Asettingstype.getfield ("useunsafeheaderparsing", BindingFlags.NonPublic|bindingflags.instance); if(Auseunsafeheaderparsing! =NULL) {Auseunsafeheaderparsing.setvalue (Aninstance, Val); } } } } }
HttpWebRequest Error The server submitted a protocol violation. Section=responseheader DETAIL=CR back must be LF