Jacques Oberto said:
"Scott M." a écrit
Hi Scott,
No offense meant but your reply is confusing me. If the page data is
isolated
from data of other page instances, are the application variables isolated
as
well or not?
Thanks,
Jacques
Well, I think you need to clarify what type of "variables" you are referring
to. In your original post, you did not mention anything about "application"
variables, which are different from "session" variables, which are different
from the variables you create within your C# or VB .NET code to process the
page.
Application variables are just that, variables that hold data that is
specfic to the application and not any particular user. A hit count is a
good example of data stored at the applicaiton level. It doesn't matter
which user is asking for it, there is only one number that represents the
current hit count and that data needs to be shared across all user sessions.
Applicaiton variables look like this: Application("HitCount") = 1000.
Session variables are also what their name suggests. They are variables that
hold data that is specific to a particular user's session and is held in
memory for the duration of the session. Session variables are used when data
from one request/response cycle needs to be carried into the same visitors
next request/response cycle that is part of the same server session.
Session variables look like this: Session("UserName") = txtUser.Text.
Regular page variables (which is what I thought you were asking about and
what my reply is based on) are the simple variables you create within the
code of your page such as:
Public Class thePage
Inherits System.Web.UI.Page
Dim x As DateTime
Sub Page_Load()
x = DateTime.Now
End Sub
End Class
In this case "x" is a page level variable that holds data specific to this
particular "instance" of the page class and would hold data that is isolated
from other instances of the same page class. If I requested the page and
then you requested the page, the server would create two different instances
of "thePage" class and each instance would have different data in its x
variable that cannot be accessed by the other.
-Scott