I have an aspx page(SEO.aspx), which receives a SEO friendly url, processes it and then transfers the control to the relevant aspx page, using server.transfer.
Now, based on certain conditions, I want to set a cookie value in the SEO.aspx and then transfer the control to the relevant aspx page.
So in my SEO.aspx
HttpCookie NewVer = new HttpCookie("newver", "true");
Response.Cookies.Add(NewVer);
But I am not sure if this will be available in the final response or not. I read http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.transfer.aspx but it does not specify anything about the response object.
What is the expected behavior?
As I understand it Server.Transfer transfers request execution from one resource to another. So if you have code executing on your SEO.aspx before you call Server.Transfer(“SomeOtherPage.aspx”) then that code will be run before the SomeOtherPage.aspx resource is executed.
This is easily tested by looking for the cookie – For example using Firefox, Install FireBug (http://getfirebug.com/) and FireCookie (https://addons.mozilla.org/en-US/firefox/addon/firecookie/) and replicate your test conditions – FireCookie will show you whether or not the cookie was planted in the browser.