Change HTTP headers

  • Thread starter Thread starter Janus Knudsen
  • Start date Start date
J

Janus Knudsen

Hello.

Im trying to change the httpheaders of a WebRequest, but I cant seem to be
able to change 'Referer'

Is it impossible? - Is some of the headers restricted and if yes, then whom?


Kind regards
 
Janus said:
Hello.

Im trying to change the httpheaders of a WebRequest, but I cant seem
to be able to change 'Referer'

Is it impossible? - Is some of the headers restricted and if yes,
then whom?

Referer is a Property of the subclass HttpWebRequest. Just downcast your
WebRequest instance or use the as operator.

HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);

HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
Debug.Assert(request != null, "Not a HttpWebRequest instance!");

Cheers,
 
Back
Top