Is there any way to know that user leaving a page with asp.net?

后端 未结 5 1940
遥遥无期
遥遥无期 2020-12-10 08:54

My question is a little bit tricky. at least I think. Maybe not, anyway. I want to know if there\'s any way to know if the user is leaving the page. Whatever if he clicks \"

5条回答
  •  清歌不尽
    2020-12-10 09:21

    Euuwww ... well ok. My problem it's because I've stored in a Session variable an objects (with a bunch of search criterias). By storing it in a session variable, if the user go back to my search page result, it will list back the same result as last time. But, after some reflexion (not in code but in my head and after seen your answer :oP), I will add a boolean property in my object which will mean something like "IsDirty" or "HasBeenListed". And when i will load back, if its set to dirty, it's gonna redirect back to another page.

    Thank David.

提交回复
热议问题