DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

how to destroy SessionVariables when navigating away from the page

rated by 0 users
This post has 7 Replies | 1 Follower

Top 50 Contributor
Posts 29
Points 535
SuperNoob Posted: 06-05-2008 8:42 PM

hi po...

panu po ba mag destroy ng Session  pag lilipat ng ibang page using the menu....

I only have access to my Module...  yung iba like the MasterPage e la ko access..

kung meron lang sana ko access sa ibang module e lalagyan ko n lng ng function during Onload nila na idedestroy yung mga session sa

module ko.

kaya ngayun naiisip ko baka may event na sa module ko na parang "BeforeUnload" tapos kill all session na ginamit ko.

hahaha merun po b nun?

ty po

  • | Post Points: 35
Top 10 Contributor
Posts 751
Points 10,140

Hey, maybe this reference could give you an idea to solve your problem: http://msdn.microsoft.com/en-us/library/system.web.ui.page_events.aspx

Good luck!

 

  • Filed under:
  • | Post Points: 5
Top 50 Contributor
Posts 27
Points 435

How about Session.RemoveAll(). Although I was thinking that putting this line in every Page_Load event is redundant. Have you tried exploring the events in the global.asax?

  • | Post Points: 20
Top 50 Contributor
Posts 29
Points 535

 nope, can't use removeAll kuya...

baka madisgrasya yung mga session nung ibang modules na hindi ako ang gumagawa..

problema wala din akong access sa global.asax, yung lead designer/programmer lang..

salamat po

  • | Post Points: 20
Top 10 Contributor
Posts 1,967
Points 39,325

 can you pass the HttpContext to your module? if yes, then you can access the current HttpContext via HttpContext.Current tapos dun mo idelete yung session value sa loob ng class mo.

HTH

devpinoy sig

  • | Post Points: 20
Top 50 Contributor
Posts 29
Points 535

 HttpContext errrrr. what's that?.....

sorry po..

so many things to learn, so little time...

salamat, po i'll research on that

  • | Post Points: 20
Top 10 Contributor
Posts 953
Points 22,750

sa tingin ko hindi practical ito, humanap ka na lang ng ibang paraan para magawa yun gusto mo. kasi web is stateless, kaya nga may session. everytime you access a page, it tries to recreate context by recalling the session variables, etc. might as well wag ka na gumamit ng session vars at magrely ka na lang sa viewstate at ASP.NET postback cycle.

yun naman onunload event ng javascript, eh kahit na anong page puntahan mo magtitrigger yun event na yun. so di rin practical.

http://devpinoy.org/blogs/cruizer
Naglalayong buksan at palayain ang kamalayan ng Pinoy .NET developer
  • | Post Points: 20
Top 50 Contributor
Posts 29
Points 535

ganun nga po ginawa ko for the meantime....

kaya lang todohan sa panget ng codes.... super rektahan

parang sa classic ginawa ko ,except walang Sesssion, relying heavily on queryString

 

kaya lang kase pakiramdam ko yun yung mas magandang solution eh...

yung i destroy ang isang specific na session on an event like beforeUnloading a page.

  • | Post Points: 5
Page 1 of 1 (8 items) | RSS

Copyright DevPinoy 2005-2008