开发者

How can I redirect to an URL with custom headers using C#?

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 c开发者_如何学编程ustom 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜