eramgarden Posted July 12, 2004 Posted July 12, 2004 I wonder if I should be doing this or not... In some of my pages, I hold, for exmple, 10-15 temp values in session vars. After the user clicks on another link,data is saved, or when user is done with that page...should I clear those temp vars from session?? Or should I just clear all the session when user clicks logout? Quote
Arch4ngel Posted July 12, 2004 Posted July 12, 2004 You can let them here so you can use them further if needed. When they log out (Session.Abandon) all temp value are cleared automaticly. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
eramgarden Posted July 12, 2004 Author Posted July 12, 2004 would leaving them in there until they logout ..add to system overhead?? Quote
Arch4ngel Posted July 12, 2004 Posted July 12, 2004 Well... it depends... for exemple... when I add some information to a DB... once I'm done with all the info... I simply clear them from the Session... But Logon information as Username ..... I keep them till the end. The main question is there : will you use this information elsewhere ? is it essential in other pages ? Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
wessamzeidan Posted July 12, 2004 Posted July 12, 2004 If the information you're saving in session variable are used in one page only, I suggest using viewstate instead, it gets cleared as soon as you leave the page... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Arch4ngel Posted July 12, 2004 Posted July 12, 2004 Yeah... of course... I was more talking about a request that extend to more than 1 page. Like a registration... On a page it ask 4 to 5 info then after 3 to 4 ... and so on... until the end. They are usually regrouped by subject (Personal info, Billing info, etc...). This is the case where I store all the value in Session but once at the end... I clear them all once the request have been registered succesfully. Using Session for usage in 1 page isn't needed... unless there's a very specific case. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
eramgarden Posted July 13, 2004 Author Posted July 13, 2004 yeah, light bulb is much brighter...2 more questions... 1. I havent come across a good website about Sessions and explaination. Do u guys have one? 2. I sometimes do this...it works but wondering if this is the right way or if i even need to do it... At the top of my page, i have Session("whatever")=string.Empty this is to reset my session var ..then i save data or whatever and set that Session("whatever")="Y". I use this value in another page . Do i need to reset my session var to blank to clear it ..I do it because i want to execute code in the other page ONLY if that session value is set to "Y" ... Thanks for the help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.