Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transfer data between pages using sessions

Status
Not open for further replies.

luigiida

Programmer
Mar 26, 2003
29
IT
Hi,
I need to save some value in the session object to use it in several pages.
I tried to do in the following way but doesn't work when more users are logged in in the same time:

To save it
Session["CompanyID"]=CompanyID.ToString();

To retreive it:
CompanyID=Int32.Parse(Session["CompanyID"].ToString());

The username is managed in this way:
(there in myReader because I read it from a db table)
Session["user"] = myReader["user"];
FormsAuthentication.SetAuthCookie(CustLogin.UserId, false);


Please, help me, it's urgent
Thanks a lot
Luigi
 
in web.config
<authentication mode=&quot;Forms&quot;>
<forms name=&quot;Cookie&quot; loginUrl=&quot;redirect.aspx&quot;
protection=&quot;All&quot; path=&quot;/&quot; />
</authentication>

in login page

System.Web.Security.FormsAuthentication.SetAuthCookie(&quot;userid&quot;, False)

it should work.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top