sean717
sean717

Reputation: 12663

Scope of the static member of .aspx class

When I declare a static member in the code behind file of aspx class. For example

public partial class MyAspNetPage : System.Web.UI.Page
{
    public static int IntVal;
}

As far as I know, the static member of a class is shared by all the instances of that class. How static member works in Asp.Net requests? The IntVal value is NOT shared among all the requests to the MyAspNetPage right? Can somebody explain and clarify? Thanks.

Upvotes: 0

Views: 65

Answers (1)

Amiram Korach
Amiram Korach

Reputation: 13286

Any static variable in ASP.NET is shared among all requests and users of the application.

Upvotes: 1

Related Questions