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

Recommended Answers

All 5 Replies

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();
  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

"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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.