ASP .NET Session

Hi,

I’m new in ASP .NET. I want to know witch is the better way of keep a user session. I have read of the following objects; session, response.cookie, response.redirect, application and cache.

My need is for only keep the username and password of the user that is obtain in a login page for use in the database connections in different pages.

I’m putting more attention in the response redirect because I can pass the parameters in the url like response.redirect(“mypage.aspx?id=xxxx?passwd=xxxx”).

With the response.redirect how can I capture the parameters in the other page?

If somebody knows a better way please tell me.

[1573 byte] By [amendez] at [2007-12-29]
# 1

There is a Session object in ASP.NET and you can put these parameters in it. The Session object is created "automatically" by ASP.NET for each user connected to the server.

Just write in your page code file a code like this:

Session("login") = userLogin
Session("password") = userPassword

You can also access the Session object by the following property of the HttpContext class:
HttpContext.Current.Session

But your question is not related to Visual Basic so please use http://forums.asp.net to ask this kind of questions.

AlexeyRaga at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...