Author: toxy | Posted on: 6/13/2008 8:01:49 PM | Views : 552

Is it not possible to specify custom headers in our HttpWebRequest GET requests?  The following code is not working:

       HttpWebRequest request = WebRequest.Create(RequestUri) as HttpWebRequest;
       request.Method = "GET";
       request.Headers["SOAPAction"] = "DELETE";   

       request.BeginGetResponse(new AsyncCallback(ResponseCallback), request);
 I get the following error when the last line is executed:
Exception was unhandled by user code
Error HRESULT E_FAIL has been returned from a call to a COM component.
 If I remove the request.Headers... line then the code is fine.
 Any way to send a GET request with a custom header?
 
...

Go to the complete details ...