且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么进行重定向时未设置cookie?

更新时间:2023-09-28 23:28:16

您正在将cookie添加到请求.Cookies集合,您希望将其添加到响应.改为收集Cookie.

You're adding cookies to the Request.Cookies collection, you'll want to add them to the Response.Cookies collection instead.

还要注意,Response.Redirect将中止我所见过的当前线程,这有时会导致问题.Response.Redirect(url,false)将重定向而不会中止.

Also note that Response.Redirect will abort the current thread which I've seen cause problems on occasion. Response.Redirect( url, false ) will redirect without aborting.