1,105,450 Community Members

Guidance for login and logout session

Member Avatar
jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi guys i am new for ASP.net application, so guide me to learn more in this programming language. Well i have my own login form. Now the problem is, i want to create a session for all pages. Which means if user does some changes in some of the field/pages then, It updates in database on that particular user file. For example If user updates his account which contains
1. Name
2. Email Address
3. Age
4. Username
6. Password
so if he changes password or email address then it should update in database of that user.

Now in other pages i have
1. Departments invoice
2. Updating previous invoice
3. Send Invoice

Whatever ever changes made in this pages it should be change under that user. Hope you have understand everything.

Would appreciate that you help.

Please do help for this post as well for my previous post which is related to inserting background image in div. Image size 960px X 88px

Member Avatar
hericles
Veteran Poster
1,078 posts since Nov 2007
Reputation Points: 98 [?]
Q&As Helped to Solve: 232 [?]
Skill Endorsements: 14 [?]
Featured
 
0
 

When your user logs in create a session variable that holds the user_id (or whatever defining information you want) like this:

Session["user_id"] = "some data";

Then you can access that at anytime during the user's session with this

String user = Session["user_id"].ToString();
Member Avatar
jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
  1. What does some data should have ?
  2. Where to put these codes?

I am new so please give me some idea or any videos that is related to my matter

Member Avatar
hericles
Veteran Poster
1,078 posts since Nov 2007
Reputation Points: 98 [?]
Q&As Helped to Solve: 232 [?]
Skill Endorsements: 14 [?]
Featured
 
0
 

"some data" would be whatever you wanted to store in the session variable. It could the user ID, their email, name, anything.
You place the code where ever you have your log in authentication code. If you have a log in button where you check the user name and password are correct that would be ideal. After you have verified the user you can set the session variable to indicate they have logged in successfully.

Member Avatar
jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

But is that valid for all pages?
Means my login.aspx.cs verify the login username and password. and after that as advice by you i have written session code. But is that valid for all the pages which needs this session.

Member Avatar
hericles
Veteran Poster
1,078 posts since Nov 2007
Reputation Points: 98 [?]
Q&As Helped to Solve: 232 [?]
Skill Endorsements: 14 [?]
Featured
 
0
 

Yes, any variables you store in session state are available to all pages called during that session. Say you had a log in section that showed the log in boxes initially but user data if they had logged in. Each page that had that section could check the session to see what the logged in status was and dispay the appropriate stuff.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article