hani
hani

Reputation: 1

Use user ID in other page

I want to create log in page with c# asp.net. I do it. Now when the user is log in, I want to get user ID and use it in other page. How can i do it? Thank you for your help

Upvotes: 0

Views: 68

Answers (3)

James Westgate
James Westgate

Reputation: 11444

You can use an encrypted cookie to store the user details and their roles. That way you can also implement the 'log me in automatically' function that a lot of websites use.

Of course all you are doing is reinventing Forms Authentication, but it is a good learning experience.

With Forms Authentication, you have login, password reset, user creation controls created for you, and you can plug in your own MembershipProvider and RoleProvider to access an existing data store.

Upvotes: 1

Canavar
Canavar

Reputation: 48088

When users log in, you should store it probably into a session variable. When the user navigates the other pages you can access it via that session variable.

Upvotes: 1

Midhat
Midhat

Reputation: 17810

You should use Forms Authentication for ASP.Net

This is a very good tutorial about it: https://web.archive.org/web/20211020150650/http://www.4guysfromrolla.com/webtech/110701-1.shtml

Upvotes: 0

Related Questions