We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,756 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Guidance for login and logout session

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

2
Contributors
5
Replies
5 Days
Discussion Span
1 Year Ago
Last Updated
6
Views
jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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();
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
  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

jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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.

hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9

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.

jazz1011
Newbie Poster
12 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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.

hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0787 seconds using 2.68MB