Passing HTTP Headers

  • Thread starter Thread starter Purushottam Khandebharad
  • Start date Start date
P

Purushottam Khandebharad

Hi all,

I need to pass HTTP Headers from onw web site to another web site as I
need to post a form on one web applications page to page on different
web site both sites are under my control,
and user credentials are to be passed from HTTP headers

I have used HTTP modules in asp.net and registerred events like
app_PreRequestHandlerExecute, begin_reuest
whenever I try to add a header in request headers collection it throws
exception as its read only

Thanks in advance
 
Wouldn't it be easier with the Webclient class? It seems to me that it
submits to a form and handles credentials at the same time.
 
Hi Ken,
I tried following option

Using "HTTPWebRequest" class we can create a request and add
request headers to that request As follows

HttpWebRequest myHttpWebRequest;

myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://Application2/Page1.aspx");

myHttpWebRequest.Headers.Add ("Key","Value");

My requirement is so that I don't want to get the response of this
page back in response stream.

I need to open this HTTP request in the browser like Response.Redirect
() does.

Problems with this approach:
i. Can not open the request in browser like Response.Redirect ().

Can you suggest some way out
Thanks in advance
 
Thus wrote Pune,
Hi Ken,
I tried following option
Using "HTTPWebRequest" class we can create a request and add request
headers to that request As follows

HttpWebRequest myHttpWebRequest;

myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://Application
2/Page1.aspx");

myHttpWebRequest.Headers.Add ("Key","Value");

My requirement is so that I don't want to get the response of this
page back in response stream.

I need to open this HTTP request in the browser like Response.Redirect
() does.

Then why don't you redirect to the page directly (or after adding some parameters
to the query string)?

Cheers,
 
Hi Joerg,

the ans is simple security reasons wont allow me to use query string
 
Back
Top