Im working on asp.net website.
In some pages I’m saving the datatable into chache as
cache[“dt”]=dt;
and using whereever I want in that page by fetching from chache.
I’m thinking that whenever session close I want to clear session in session_end event of global.asax file.
as cache[“dt”]=null;
What is the better location to close either application_end or session end.
If I close in session_end will it affect to another user?
Please provide me clear helpful info regarding this.
Thanks
Im working on asp.net website. In some pages I’m saving the datatable into chache
Share
Since you are putting the datatable in
Cache, meaning, that it’s shared by all the users, then there’s no right place/need to do this, since the only time when it actually needs to be removed is when the application ends and at that point all resources are freed; your application is no longer running.Perhaps what you should/meant to do was to put the datatable in
Session. If that is what you want, then you could remove itOnSession_EndinGlobal.asaxbut know thatSessionEndis not guaranteed to fire. You can also doSession.Abandon()when the user logs out, which will clear all session objects.