Add User session infomation to HTTPContext

183 views Asked by At

I am Having a User Class now i want to add that class to HTTPContext object so that each time i send a request I don't have to validate it

1

There are 1 answers

0
christofr On

ASP.NET has several state management approaches - you need to choose the one most suitable to your need, and then store your validated user credentials once only.

If you have a single server setup, and can't see the need for multiple servers / a web farm in the future, you could consider using ASP.NET Session State.

Session State uses in-process memory on the server - so if you are spreading requests to multiple servers, this approach won't work. You would then consider storing an authentication token in your database. You can have a mixture of the two - storing session state in the database.

Lastly, you could consider using ASP.NET Membership, which simplifies the job of creating and managing users, authentication, and authorization.