1

Is it possible to set parameters in the header of an HttpResponse, then redirect?

I tried something like this:

Response.Headers.Add("test", "1234"); 
Response.Redirect(www.targetpage.com);

and then

 var result = Request.Headers["test"];

My problem is that I don't find the parameter in my request result is always null and I cannot pass the the parameters in the url I need a solution with the header, thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Aziz
  • 21
  • 5

1 Answers1

1

You are redirecting the client, so anything you sent to the client in the Response is probably flushed/discarded. If your intent is to control the redirect then you'd need to handle that in js on the client.

There are many ways to implement your own messaging:

How to send data from C# to JavaScript/AJAX webpage

T McKeown
  • 12,971
  • 1
  • 25
  • 32