开发者

Dispose() on asp.net pages

开发者 https://www.devze.com 2023-03-17 12:08 出处:网络
I have ASP.NET web site and I get a session id from a web service where I am going to use throughout rest of pages.I am passing this session id between pages to peform some action.What I am trying to

I have ASP.NET web site and I get a session id from a web service where I am going to use throughout rest of pages. I am passing this session id between pages to peform some action. What I am trying to achieve is that I want to make sure I release this session id from the web service by calling it's logout method when the user closes a page. I am thinking to add Dispose() on each page and call the logout method. Does Dispose() get called when the user closes a page (browser)? Or, how can开发者_开发百科 I call the logout method when a page is closed?

Thanks.


Dispose will get called at the end of each page call, not at the end of the user's session. It sounds to me like you want to use the Session_End event (in the global.asax) to end the web service session. If you call the logout in the page dispose you'll have to login again every time the user loads a new page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号