Way around ASP.NET session being shared across multiple tab windows

后端 未结 6 682
半阙折子戏
半阙折子戏 2020-12-09 17:17

I\'m storing some value in an asp.net session on the first page. On the next page, this session value is being read. However if multiple tabs are opened and there are multip

6条回答
  •  Happy的楠姐
    2020-12-09 17:50

    Another way to do it is to use a Server.Transfer or a CrossPagePostBack. Then you can access all of the previous page's variables using Page.PreviousPage. If Page.PreviousPage is null, you know the user came to the page directly and you should process page 2 with that in mind.

    I can't really recommend it though, because with Server.Transfer you don't update the URL in the browser and CrossPagePostBack makes everything a postback, which can lead to problems like the back button not working "normally".

提交回复
热议问题