0

Hello!

1) I have no idea how to use Session objects, especially when it has to remember the Session of the logged user. When the user clicks logout, his session should be removed until the next time he logs in.

2) Also, how to validate the user in such a way that the user shouldn't sign up or log in as Admin of the website. Only customers can login as customers and Admins can log in as Admins.

Thanks..

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by pinkygirl
0

Hi,
This is a bit of theory that might give a bit of idea about sessions. Because every programmer working for Web/or such applications loves to deal with session,i would love to help you with this problem.


ASP.NET Session state provides a place to store values that will persist across page requests. Values stored in Session are stored on the server and will remain in memory until they are explicitly removed or until the Session expires.

Storing and retrieving a value in the Session is as simple as:

VB

Session("Name") = "John Doe"'orSession.Add("Name","John Doe")'retrieving

Dim Name As String = Session("Name")

C#

Session["Name"] = "John Doe";//orSession.Add("Name","John Doe");//retrievingstring

Name = (string)Session["Name"];

This is the link where you will get a code snippet and more detailing

SessionExample

Happy Coding :)

0

I always find Session difficult, anyway, thanks for the help. I'll read that blog. Do you happen to know the codes for implementing session of a user?

0

Yes i know how to check whether user is logged in or not through sessions.
Infact that example also contains all you want,but if you want it to be simple and more easy then write here,i will provide you with a sample example.

0

Wait till tomorrow,i will write here a complete code with database and login page,that how session works.

Till that time,Happy codding :)

0

wow!! Thank you so much :D I really needed those codes. I want to implement them in my .net website and college project

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.