Start New Discussion within our Web Development Community

Guys i am niew for the .net site development. I have a small question. I have my personal login page created in jquery. I am not using login form of Now the question is how to create a session for the user. I have 4 web pages (Below are the list).

  1. Index
  2. About
  3. Health & Fitness Tracker (This site is for the user. User can get his health personal health tracker. And even tracks it means user can latter on check his/her history)
  4. News and article. (News user can check the different news and article. Even User can check his history page which ever news and article he looked at)

Now how to create session for all 4 webpages.

How to define globally so that i do not have to define it again and again.

Even define globally Logout session too. Please help me.

You can store name/value pairs in session state very easily. Once you have logged in a user you can set the ssions variable like this:
Session["loggedIn"] = "true";

You can then later alter the session variable or check it for logged in status. In your global.asx file you can specify any session variables you are going to use by setting them up in the session_start section.

I hope that helps.

When you press login button after entering data.. just mention session["loginin"] = "true"; in button_Click method.

thanks for telling about login or logout session, what is highest session time we can cutomised on .net sites?

I'm not sure what the actual limit is (although I think I once read it was a year) but you wouldn't want to have it more than an hour or two surely. If you set it to a very long time you're going to be wasting a lot of server memory with session variables that aren't even being used anymore.

This question has already been answered. Start a new discussion instead.