Passing HTTP Headers

  • Thread starter Purushottam Khandebharad
  • 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
 
K

Ken Cox - Microsoft MVP

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.
 
P

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://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
 
J

Joerg Jooss

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,
 
P

Purushottam Khandebharad

Hi Joerg,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top