Quote:
|
request.cookies.get is a static method. IS this right? ANd it is returning what?
|
No, it's not. It's a collection property (not a method) on an *instance* of the Page class. If it were static, all users in your system would share the same cookies ;-) The type of the collection is HttpCookieCollection. You can read more about cookies in ASP.NET here:
http://msdn.microsoft.com/en-us/libr...t.cookies.aspx
http://msdn.microsoft.com/en-us/library/ms178194.aspx
Quote:
|
i am assuming it is returning the object made from the selected index function. which is stored on your hard drive in the interenet cookie section right. AND then it is putting the name "preferredtheme" into the httpcookie object preferred theme.
|
Yeah, sort of. It's a collection filled by ASP.NET for each request based on the cookies that the browser submits. Each item in the collection is an HttpCookie that contains data you as a developer have assigned to it (as well as other cookies that may have been set for the domain). In the SelectedIndexChanged method of the Master Page you created an HttpCookie, added it the *Response.Cookies* collection using PreferredTheme as the key which in turn caused the cookie to be sent to the client. Then on each new request that cookie is sent back to the server where it's available in the Request.Cookies collection.
Quote:
|
so page is a static class
|
No, it's not. or all users would be sharing the same page. Each request for an ASPX page results in a new instance of the Page class being created. The code you write in the code behind then works against that instance.
Hope this helps,
Imar