Peter,
When you redirect, a 302 response is sent back to the client. It is the
client that then gets the URL to redirect to, and the client which
subsequently makes the request. Because of this, you can't change the
headers that are sent.
What you want to do is call the Transfer method on the HttpServerUtility
(the Server property on the page, or the HttpContext) to transfer processing
to another page. You can opt to keep the form properties that were sent in
the initial request.
However, you will not be able to append any values to the Form values
sent with the request. While Form returns a NameValueCollection, it does
not allow you to add elements to it once it is populated.
Rather, what you should do is encode the information in the URL, or have
a key that you append to the URL which points to something in session state
that your page can retreive.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Peter Kirk" <pk@alpha-solutions.dk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi
I need to write a method which accepts a url (string) and redirects to it.
In addition to this I need to either (a) add a parameter to the url; or
(b) add the parameter to the header of the redirect request.
To add a parameter I guess it's as easy as adding "?myparam=myvalue" to
the url (or "&myparam=myvalue" if there already are parameters in the url
string I get).
But how do I add a header? Can I use Request.Headers.Add("myparam",
myvalue), and then do a Redirect?
Thanks,
Peter