Sessions in ASP.Net

Results 1 to 3 of 3

Thread: Sessions in ASP.Net

  1. #1
    Join Date
    Dec 1969

    Default Sessions in ASP.Net

    I the "old" asp-days i&#039;d make a login.asp that checks in database if username/password entered is correct and if correct I&#039;d assisgn UserID from DB to a sessionvariable. This way i can retrieve the data from each page that concerns this user by simply pass the session("UserID") as a param to stored procedures. <BR>Now, with, its seems to be forms authentication one should use. But how to store the userid so it can be retrieved in each page- in a sessionvariable <BR>I know that authenticating using Form, the username is stored in cookies. But I NEED to store the EmployerID to sessionVARIABLE - it is my preference <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Sessions in ASP.Net

    Its almost similar as in ASP for storing the session variables.<BR>For example:<BR><BR>C#<BR>Session["username"]="user name";<BR>Response.Write(Session["username"].ToString());<BR><BR><BR>session("username") ="user name"<BR>response.write(session("username"))<BR><B R>And in forms authentication, you first authenticate the user by pulling the data from the database and if the user is a valid user then you can store the user name in the session variable using the above code.<BR>

  3. #3
    Join Date
    Dec 1969

    Default you dont need Session

    you can store the "code/userid" you talk about in the Certificate that the server gives the user<BR><BR>here&#039;s some example code<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts