1

I have a bunch of parameters that I need to pass onto a second page via request headers. At first I tried via JS but I found out that that's impossible (please correct me if I'm wrong here).

So now I'm trying to do it in the code-behind (via C#). I want to write a bunch of custom request headers and call Response.Redirect or something similar to redirect user to the new page.

Is this possible? If so what methods do I have to use?

Edit: unfortunately using QS parameters is not an option here as it's out of my control.

2 Answers 2

1

Use a

Server.Transfer("somepage.aspx?parameter1=value");
There is no client redirect then. You can try setting the headers and do a Server.Transfer - I believe that will work to - up to you, but using the querystring is a bit more readable to me and doesn't show up in the clients browser.

2
  • Unfortunately using QS parameters is out of my control. How would I set the header prior to the Transfer call? What object is that in?
    – encee
    Jun 8, 2011 at 23:20
  • Request.Headers.Add - BUT!!!! this depends on the version of IIS - see: stackoverflow.com/questions/6283458/… Jun 8, 2011 at 23:44
1

you need to look at state in .net their are various ways to achive state.. in a stateless environment.

i would put it in the session object on page one.. read it on page 2...

create a session object on code behind page 1

read from session object on page 2.

or if you read the msdn state documenation on request paramters this will show you the options avliable.

JS dont worry about doing tricky stuff with it.. mostly trickey is wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.