Sie Ste

Sie Ste

  • NA
  • 196
  • 184k

session variables

Jun 24 2012 6:28 PM

I have a question about using session variables since this is the first C# 2010 web form app that I am writing.

  Right now I am passing 3 session variables between 2 web pages in the web application that I setup. This is a data entry application where some information is entered on page 1 and the rest of the information is entered on page 2.

  When the user has finished entering the information for the first customer. Now the user will be ready to setup information for the second user.

From what I have seen on the internet session variables last up to 20 minutes. Thus I basically do not want the information saved from customer 1 to be entered into the database file for customer 2 by using session variables.

Thus to prevent this from occuring, I am coding the following before the user clicks the button to enter data for the next customer:

Session.Remove("var1");

Session.Remove("var2");

Session.Remove("var3");

Response.Redirect("~/page1.aspx");

Can you tell me if this is the best method for clearing out session variables and/or if there is a better process you would recommend? Can you tell me and/or point me to a reference that will explain your answer to me?

Answers (1)