Is it possible to set a cookie during a redirect in ASP.NET?

后端 未结 1 1037
眼角桃花
眼角桃花 2020-12-06 03:16

I am using ASP.NET. I either add or set a cookie (depending on whether the HttpRequest contains a cookie with specified key), and immediately afterward call

相关标签:
1条回答
  • 2020-12-06 03:45

    After googling a bit it seems that yes, there can be problems with setting the cookie in the redirect response as it may be ignored by a few browsers. (It may make some sense, as the response is really telling the client to ignore the resource and get some other resource instead).

    This has been discussed here already: Sending browser cookies during a 302 redirect

    So I would change the architecture in a way that allows the page being redirected to to set the cookie.

    0 讨论(0)
提交回复
热议问题