473,762 Members | 8,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpApplication State data being lost

We have an ASP.NET 2.0 web site, running on IIS version 6.0, Windows 2003
server. On the Application_Sta rt event of the Global.asax.cs, we load
configuration values to the HttpApplication State dictionary, to be used
throughout by all web site pages, on a read-only fashion.

The problem we are experiencing is that, after running for some hours, the
values of the HttpApplication State are lost. Our code never assumes there is
a possibility that the golbal data is not there, so it crashes with a
NullReferenceEx ception exception.

So for instance, we have this line of code in the Global.asax.cs:

protected void Application_Sta rt(Object sender, EventArgs e)
{
Application["SiteName"] = " Our web site";
}

And we have this kind of code in our ASP.NET pages.

string siteName = Application["SiteName"];

I know that if you are using the ASP.NET Cache object, you are supposed to
check if the data is still there, since it could have already been scavenged.

But I expected the HttpApplication State not to have this issue, so our code
would never need to check if data was still there.

I thought the only time HttpApplication State data would be reset would be
when the web site Application Domain was shut down (either due to ASP.NET
worker process reset or IIS reset).

But in this case, I was expecting the Application_Sta rt event to be
triggered again upon the first request after the Application Domain shut
down, so the data would be loaded again to the HttpApplication State
dictionary.

Is there any circumstance where HttpApplication State dictionary entry may be
reset or scavenged during the lifetime of ASP.NET Application Domain, like it
happens with the Cache entries?
Sep 16 '08 #1
1 2833
you can make a static class

class X{
static public string SiteName{
get{
if(Application["SiteName"]==null)
Application["SiteName"] = " Our web site";
return Application["SiteName"] ;
}
}
}

in this case ,if the app/host doesn't reset. Application["SiteName"] will
be load once.as same as in application_sta rt,and it's not load the data at
the host start up,but you use it first
----------------------------------------------------------

"mnowosad" <mn******@discu ssions.microsof t.com写入消
news:7D******** *************** ***********@mic rosoft.com...
We have an ASP.NET 2.0 web site, running on IIS version 6.0, Windows 2003
server. On the Application_Sta rt event of the Global.asax.cs, we load
configuration values to the HttpApplication State dictionary, to be used
throughout by all web site pages, on a read-only fashion.

The problem we are experiencing is that, after running for some hours, the
values of the HttpApplication State are lost. Our code never assumes there
is
a possibility that the golbal data is not there, so it crashes with a
NullReferenceEx ception exception.

So for instance, we have this line of code in the Global.asax.cs:

protected void Application_Sta rt(Object sender, EventArgs e)
{
Application["SiteName"] = " Our web site";
}

And we have this kind of code in our ASP.NET pages.

string siteName = Application["SiteName"];

I know that if you are using the ASP.NET Cache object, you are supposed to
check if the data is still there, since it could have already been
scavenged.

But I expected the HttpApplication State not to have this issue, so our
code
would never need to check if data was still there.

I thought the only time HttpApplication State data would be reset would be
when the web site Application Domain was shut down (either due to ASP.NET
worker process reset or IIS reset).

But in this case, I was expecting the Application_Sta rt event to be
triggered again upon the first request after the Application Domain shut
down, so the data would be loaded again to the HttpApplication State
dictionary.

Is there any circumstance where HttpApplication State dictionary entry may
be
reset or scavenged during the lifetime of ASP.NET Application Domain, like
it
happens with the Cache entries?

Sep 17 '08 #2

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

Similar topics

0
1765
by: Fabian Kr?ger | last post by:
Hello, I got a weird problem and need your help and ideas... Ive written an php application which imports data in XML format and writes this data to a MySQL database to have a faster access. The application uses Expat 1.95.7 via php to render the xml data. First everything seemed to work fine. But now I noticed that something
0
1171
by: Bob Reader | last post by:
I am new to multithreading concepts and want to ensure i am doing the following correctly: I am planning to create a custom object and store it in the HTTPApplicationState of an ASP.Net application. This custom object will be created at startup and not modified thereafter. The object will have one property which holds a Hashtable. The Hashtable uses strings for keys and ListDictionaries for values. Each ListDictionary uses strings...
0
2103
by: CJ | last post by:
Hi We have Session Data lost randomly and Session State expired early. Our Intranet Application uses Window Server 2003 and .Net Framework 1.1. We set Session Time out to 60 minutes. but user Session Data lost randomly and Session State sometime expired early. I pretty run out the solution to fix this problem. Althoug we use Web Farm but we have Sticky IP to let user request go to the same server all the time. We turn off the Web...
32
3228
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being lost when they move to a new record. This seems to be the case when there are multiple users. When there is a single user using it, we don't seem to have that problem. It seems that we had this problem when we first converted from an MDB back end...
7
2294
by: Neil Ginsberg | last post by:
I'm having some problems with an Access 2000 MDB file with a SQL Server 7 back end, using ODBC linked tables. I previously wrote about this, but am reposting it with some additional information and in summary form, in hopes that someone might have an idea about what's going on. I am using a bound form which is losing data a significant portion of the time. Basically, the form contains 6 fields and three subforms, as follows: Field A...
5
2136
by: Natan | last post by:
Hi! I have an object stored in the HttpApplicationState collection of my site, but i would like to mantain the state of this object even if the application restart, so in case of any problem or when I change something in the web.config or add anything to the bin directory, i can load the last values from somewhere and continue the work. I'm using serialization to accomplish this, and it works ok. But i'm serializing the object to a...
0
996
by: Ajay Choudhary | last post by:
Hi, I have a custom SoapExtension class and in the "ProcessMessage" method I would like to get a handle of HttpApplicationState object. How can I do that ? Thanks, Ajay
2
3140
by: moi | last post by:
Hello, Dim strConn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Application.StartupPath & "\app_data\aaaaaa.mdb;" Application.StartupPath does'nt work with ASP.NET 2 : BC30456: 'StartupPath' n'est pas un membre de 'System.Web.HttpApplicationState'
0
2071
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media. Call for a free consultation. http://a.uuload.com/Computer-Data-Recovery.htm LiveVault's Online Recovery Service Protect vital data with LiveVault's offsite backup and data storage. http://a.uuload.com/Computer-Data-Recovery.htm
0
10137
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9927
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9812
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7360
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3914
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
3
3510
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.