Say I have a page MyPage.aspx with corresponding code-behind file MyPage.cs. In MyPage.cs I have a string property, say Title. Two clients navigates to MyPage. Does this mean that both of them have an instance of the main class in MyPage.cs?
If I have an editable header, binded to the Title property and one client changes her title. How does the server call know which instance of MyPage.cs it is binded to? I hope my question makes sense.
Best How To :
The HTTP protocol is stateless. This means that when the user has loaded a page and is looking at it, there is no connection to the server.
When the user initiates a connection to the server, such as when clicking a submit button, that is when the page is instantiated. Each user will get a separate instance of the page object.
If you have a string property on the page object, it will go out of scope and be destroyed after the server is finished responding to the request (after the page is done loading). Values will not be saved between requests unless you put them in a persistent place like session state, view state, the URL, a database, a file, or a cookie.