473,563 Members | 2,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove Things in Application State After Period?


I would like to remove things from Application state if they are older
than 15 minutes. How can I do that?

Thanks.
Jun 25 '07 #1
3 1170
Depends how you stored them in Application State. There is nothing to stop
you from creating a little "container" class that has an object field to hold
your "thing" and a DateTime field to hold the time you stored it.

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"lucius" wrote:
>
I would like to remove things from Application state if they are older
than 15 minutes. How can I do that?

Thanks.
Jun 25 '07 #2
Hi Lucius,

For your scenario, you want to store some shared objects in the global
Application State collecction and make it be cleared after a certain
period. I think you'd better consider using the Application Cache instead
of ApplicaitonStat e. The Application Cache is also a global storage of
ASP.NET application and you can store and access items into it like a
dictionary. Also, you can supply a CacheDependency for each cache item so
as to control how will the cached item expired(be removed from cache
collection). e.g.

//cache and object and supply the lifetime(to expire)
Cache.Insert("i tem key", objectToCache, null, DateTime.MaxVal ue,
TimeSpan.FromSe conds(10));

#Cache.Insert Method (String, Object, CacheDependency , DateTime, TimeSpan)
http://msdn2.microsoft.com/en-us/library/4y13wyk9.aspx

Actually, the ApplicationStat e is provided for backward compatibility to
original classic ASP. You can use Application Cache to replace
ApplicationStat e in ASP.NET application.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 26 '07 #3
Hi Lucius,

Does the cache approach mentioned in last reply address the problem? If you
have any further questions, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4567
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET Here's the scenario: 1. .NET Windows Client on a remote machine makes a web service call to update tables on a Web Server running SQL Server...
1
2152
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET Here's the scenario: 1. .NET Windows Client on a remote machine makes a web service call to update tables on a Web Server running SQL Server...
0
14066
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET Here's the scenario: 1. .NET Windows Client on a remote machine makes a web service call to update tables on a Web Server running SQL Server...
2
1786
by: =?Utf-8?B?Q2hhcmxpZQ==?= | last post by:
I have written an ASP.Net web application in C#. On Appplication_Start the code loads some data from the database into memory. It stores the data in Application State variables. The data is read only. So far so good. If no one uses the Application for a certain period of time IIS unloads it from memory. If someone then access the...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.