Application Variable disappears. v2.0

G

Guest

I've migrated an application from VS 2003 to VS 2005. It worked fine in
2003; but I've been having issue in 2005. The latest is dealing with a
DataSet that I have as an Application Variable. It seems to disappear when
the users session times out. What really weird is that it works fine on my
development box; but flakes out on the server. I added a button to a dummy
webpage to reload the Application variable; but it still disappears after the
session timeout.

Could the DataSet in the application variable be a reference, and that when
the session that created that dataset times out that reference is now being
set to null. If so, how do I get arround that?

I am loading the dataset via a webservice; but the same webservice loads the
development box application data just fine. Yes, the web config files point
to the same url for the webservice.

Snippet of code from Global.asax.cs
protected void Assign_Standard_Data()
{
try
{
localhost.LnD_Hydraulic_General proxy = new
LnD_HydraulicApplication.localhost.LnD_Hydraulic_General();
DataSet Standard_CDs = proxy.Get_STDCodes("VALID");

if (Standard_CDs != null)
{
Application["Standard_Data"] = Standard_CDs;
}
else
{
throw new Exception("Global:Assign_Standard_Data - Unable to access
STDCodes Database.");
}
}

catch (Exception error)
{
throw new Exception(error.ToString());
}
}

protected void Application_Start(Object sender, EventArgs e)
{
Application["Support.Email"] = "(e-mail address removed)";
Assign_Standard_Data();
}

protected void Session_Start(Object sender, EventArgs e)
{
if (Application["Standard_Data"] == null)
{
Assign_Standard_Data();
}
}

Any help would be appreciated.
 
G

Gabriel Magaña

Are you deploying to Win2003 server while developing on a non-Win2003
machine? If so it may be that the application worker processes have the
same timeout as you session does, and it appears that your application
variable is being destroyed by the session end while it is in fact timing
out at the same time.
 
R

Rune B

I've migrated an application from VS 2003 to VS 2005. It worked fine in
2003; but I've been having issue in 2005. The latest is dealing with a
DataSet that I have as an Application Variable. It seems to disappear
when
the users session times out. What really weird is that it works fine on
my
development box; but flakes out on the server. I added a button to a
dummy
webpage to reload the Application variable; but it still disappears after
the
session timeout.

Could the DataSet in the application variable be a reference, and that
when
the session that created that dataset times out that reference is now
being
set to null. If so, how do I get arround that

Probably, consider using Cache instead of Application. It is far more robust
and flexible in terms of paralel access to datasets and objects in general.

From the code, it seems that the Session_Start() section is just repeating
the Application_Start() - that should not be nessesary.

R-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top