B
Bob
Hi,
How does one initiate and persist variables between users in an asp
webservice or is that even possible? For instance, I did a very
simple test case below. I would like the timeStart variable to be
initialized once at server startup and have all users who subsequently
call the webservice get the initial time, not the time when they call
the service. It seems like the whole process is restarted everytime
the service is called, with a new timeStart being generated each tme.
Thanks,
Bob
public class Service1 : System.Web.Services.WebService
{
DateTime timeStart = new DateTime();
public Service1()
{
timeStart = DateTime.Now;
}
[WebMethod]
public string HelloWorld()
{
return "Hello World"+timeStart;
}
}
How does one initiate and persist variables between users in an asp
webservice or is that even possible? For instance, I did a very
simple test case below. I would like the timeStart variable to be
initialized once at server startup and have all users who subsequently
call the webservice get the initial time, not the time when they call
the service. It seems like the whole process is restarted everytime
the service is called, with a new timeStart being generated each tme.
Thanks,
Bob
public class Service1 : System.Web.Services.WebService
{
DateTime timeStart = new DateTime();
public Service1()
{
timeStart = DateTime.Now;
}
[WebMethod]
public string HelloWorld()
{
return "Hello World"+timeStart;
}
}