Reading/Writing Session variables from a Static class

A

aliendolphin

I'm having a strange problem possibly with Session variables for one
user being accessed by another.

I use a static utility class with static methods which get and set
certain Session variables. For Example:

public static string UserEmail
{
get { return HttpContext.Current.Session["email']; }
set { HttpContext.Current.Session["email"] = value; }
}

But, user A making this call was able to get back the email session
object for user B.

I would think that no matter how many users are using the static class,
they all get and set their own session variable "email".
Since I'm not storing the Session info in the static method but just
grabbing it. This should work, right?

Thanks
 
C

Craig Deelsnyder

I'm having a strange problem possibly with Session variables for one
user being accessed by another.

I use a static utility class with static methods which get and set
certain Session variables. For Example:

public static string UserEmail
{
get { return HttpContext.Current.Session["email']; }
set { HttpContext.Current.Session["email"] = value; }
}

But, user A making this call was able to get back the email session
object for user B.

I would think that no matter how many users are using the static class,
they all get and set their own session variable "email".
Since I'm not storing the Session info in the static method but just
grabbing it. This should work, right?

Thanks

Don't have an answer, but yes it should. I've done this before myself,
where you're creating a 'session utility' class....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top