How can i use Application Object
-
-
Hi all, I use Application object in ASP.NET. I set it’s value in one page and read it in another page but I don’t know when I can dispose this object in order to in the first page it’s not set and if an event accord it set again. Thanks in advance
You should only use the application object for things you want to keep across user sessions. Like some sort of static data that all users would be looking at. It sounds like you should be using a session variable to pass things from one page to the next. Session is very similar to the application object except it is only for that user, other users can see that object, they can only see their own session object. Either way if you want to remove and object from the session or application you can just set it to null or Nothing in vb.net. There is also a Remove method in the object to remove something from the application or session object. Hope that helps. Ben
-
You should only use the application object for things you want to keep across user sessions. Like some sort of static data that all users would be looking at. It sounds like you should be using a session variable to pass things from one page to the next. Session is very similar to the application object except it is only for that user, other users can see that object, they can only see their own session object. Either way if you want to remove and object from the session or application you can just set it to null or Nothing in vb.net. There is also a Remove method in the object to remove something from the application or session object. Hope that helps. Ben
-
You can use the session and application object anywhere in the codebehind. All events have access to it. Ben
-
I use it in Finalize Method of the page but in order to access again to it i don't know What i can?
Perhaps it is better for you to explain what you are trying to do and then I might be able to suggest something for you to try. Finalize method of the page seems like a strange place to set a variable in session or application. Most of the time I set it in th page load event. Ben