Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are static objects unique per user?

I have a .net application (c#) that goes something like this

public partial class _Default : System.Web.UI.Page
{
    #region initial variables setup

    private static exam theExam;

    #endregion


    protected void Page_Load(object sender, EventArgs e)
    {
       if(!IsPostBack)
       {
        string userid = Request.Querystring["user"].ToString();
           theExam = new exam(userid, "some values");
       }
    }
// rest of code.

Now my question is, if user 105 logs in an instance of exam theExam is created and assign to the static declaration on top. If user 204 then logs in from a different computer, does the static object at the top gets the value of 204 even on user's 105's computer?

like image 920
Migs Avatar asked Sep 23 '10 21:09

Migs


1 Answers

No, the static object is the same instance for everyone logged on. Also the object doesn't live on 105's computer but just on the web server ofcourse.

like image 98
Sander Rijken Avatar answered Oct 02 '22 16:10

Sander Rijken