Member variables in Web Service class



Hi, if I have the following class:

[WebService(Namespace = "http://www.softease.com/Podium";)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MyWebService : System.Web.Services.WebService
{
private String m_name;

[WebMethod]
public String SayHello(String name)
{
m_name = name;
return "Hello " + m_name;
}

[WebMethod]
public String SayGoodbye()
{
return "Goodbye " + m_name;
}
}

That won't work will it? Because WebService's are stateless? Even though I keep an instance of the web service on my client.

So how can I store information, such as a username? I know I can use the Session object, but I was lead to believe that it isn't best to use the Session object in web services??


Any help is much appreciated.

Cheers,
.



Relevant Pages

  • Re: Member variables in Web Service class
    ... [WebMethod] ... public String SayGoodbye() ... I know I can use the Session object, but I was lead to believe that it isn't best to use the ... Global.asax was added per default to each new web app (web service or web site). ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Error when WebMethod returns a jagged array
    ... incoming and outgoing messages. ... > type of the WebMethod contains a jagged array. ... > public string description; ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Initializing static variables
    ... [WebMethod] ... public string InitR6 ... lock ) ... they recommend locking a static object: ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • returning more than first element from sql server
    ... IM AM NEW TO WEB SERVICE AND C# AND HAVE A QUESTION / PROBLEM ... [WebMethod] ... public string logtime(string ClientUserName) ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Please help!!!!!
    ... <WebMethod> ... Public Function checkStatusAs String ... Public String checkStatus ... any problem in it it should return exception xml otherwise normal ...
    (microsoft.public.dotnet.framework.aspnet.webservices)