Redirect和Transfer的传值

在一个页面中跳转使用Redirect跳转,要想获取跳转前的cookie,请修改为Transfer方法。

如:

string url = TemplateSourceDirectory + "/Default.aspx?userGroupID=" + userGroupID + "&endUrl=" + endurl;

Response.Redirect(url);

修改为:
Server.Transfer(url);

在跳转成功后,这样就能获取跳转前的cookie或session的值。

原文地址:https://www.cnblogs.com/antyi/p/2489137.html