"RJ" <RJ@PostOnly.com> wrote in message
news:OT*************@TK2MSFTNGP11.phx.gbl...
Sami,
Thanks for performing the test. I have not enabled SessionState. I am
simply adding values to the Application object in the Application_Start
event handler method. Seconds later, I call other web methods in this web
service, which attempt to access the Application object by key ( Dim myVar
as String = Me.Application("Name") .... in VB.NET)
I immediately print out the value of myVar and it is never set. I am
assuming that Application_Start is called once before the first call to
any web method? Is this approach sound, or should I add the values to the
Application object somewhere else in the web service code?
Yes, Application_Start is called once on the first request to a web
application.
I suggest you put in the test code in my previous post to see how it behaves
for you. If it works then the Application object is working the way it is
documented.
Some additional things I'd do to debug the problem:
- Make sure you access the Application object from same web application that
sets it (same virtual directory)
- Are you running a web farm? If so, then Application won't work.
- Put break points in event handlers in Global to trace a request. Check the
contents of Application on every break, or
- Add code to event handlers in Global to print out all the values in
Application:
foreach (string key in Application.Keys)
{
System.Diagnostics.Trace.WriteLine(string.Format(" key: {0} value: {1}",
key, Application[key]);
}
hth,
Sami