Checking the session presence in ASPWe can display a welcome message to a visitor inside a member area based on his session status. If the member has not logged in then we can ask him to login. You must have observed in many sites and forums you will get a welcome message if you are logged in and the same place will show login form or link to login form if you are not logged in. How this is done ? We will learn that.If the member is logged in then userid of the member will be available in session variable. So we will try to read the value of the session variable and display a welcome message like this Welcome smoIf session variable is not present then we will display a login window or show a link to login page like his
Userid
We will be using one if condition in ASP to check the session and display the welcome message if userid is present , else we will show the login form. Here is the code to do this
|