I have a page where based on certain conditions I am either doing a Response.Redirect or Server.Transfer. Now I want to add a header for both the cases. So I am doing the following
Response.AddHeader("Vary", "User-Agent");
if (condition)
{
Server.Transfer(redirectUrl);
}
else
{
Response.Redirect(redirectUrl);
}
Now, when the code goes via Server.Transfer code path, the Vary header is set to * whereas when it goes via Response.Redirect the header is correctly set to User-Agent.
Why does this happen and how can I set the Response Header to be same for both the cases?