alizx
alizx

Reputation: 1188

which parts of asp.net website are shared between users?

In asp.net website project, is pages and .cs files compile for each and every client ? how can I learn this sort of information is there any resource? which parts of website are shared between users?

Upvotes: 0

Views: 146

Answers (3)

John Saunders
John Saunders

Reputation: 161783

Generally speaking, there is only one copy of the web site for all users.

There is only one copy of any static (Shared in VB.NET) data, for all users, so be careful. Some developers assume that these values will magically be turned into per-session variables, but no. (I used to think that way, then learned).

If using Session state, then each browser session will have one copy of Session. This is cookie-based, so the same user using IE and FireFox will have two sessions.

Each request to a page creates a new instance of the Page class and any controls on that page.

Upvotes: 1

Ted
Ted

Reputation: 4067

Pages and cs files are compiled by the server (or they can be pre-compiled using Visual Studio) and they are served to each client according to the request as HTML.

Re-compilation of the code is caused by changes in the bin folder or web.config file and not by different users accessing the pages.

I admit that I don't fully understand the question, but if you are talking about common data or "global variables" of the legacy type, then I can add that there are session-wide variables and application-wide variables. Application wide variables retain the same values for all users as long as the application is running.

Upvotes: 1

Banana
Banana

Reputation: 7473

asp.net is session based, you get new pages and variables/objects per session, so every user gets his own 'session' of the website unless he hijacks someone else's session.

if you want to share a variable/object between users, declare it as static. you can make singleton classes which are also shared between users.

Upvotes: -1

Related Questions