473,739 Members | 4,265 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 2830
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
1764
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
1169
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
2102
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
3226
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
2134
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
995
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
3138
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
2068
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
8792
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
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...
0
9337
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9209
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...
0
4570
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
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
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
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.