ohavryl
ohavryl

Reputation: 407

MVC4 add header to redirect response does not work

While debugging the following code I see the header is added:

System.Web.HttpContext.Current.Response.AppendHeader("Authorization", "Value");
System.Web.HttpContext.Current.Response.Redirect(redirectUrl);

But it is not present in the final HTTP request.

Upvotes: 2

Views: 655

Answers (1)

hutchonoid
hutchonoid

Reputation: 33316

The Redirect terminates the current request which has the set the header value.

As it is a new request, the header is not present.

Upvotes: 1

Related Questions