I want to define a property in asmx web service that shared between all web methods. this is my question:
Code:
myWS test1 = new myWS();
test1.SetToken(UserID1);
test1.AnotherMethod();
//stuff...
myWS test2 = new myWS();
test2.SetToken(UserID2);
test2.AnotherMethod();
Webservice:
[WebService(Namespace = "http://test.ir/")]
public class myWS : System.Web.Services.WebService
{
public string Token { get; set; }
Public void SetToken(int UserID){
this.Token= BLL.GetToken(UserID);
}
Public void AnotherMethod(){
BLL.CheckToken(Token);//i want token value be per every myWS web service defined
}
}
notes: * static property is not good,because is share between all users,i want token value be unique in every myWS test = new myWS()
thanks.
Edits:
My app runs on a pc in every user start up and all instance call my web service
I found that any instance of web service is unique. we resolved this by sending param to our methods,associate that to a public property and use in other methods of that instance of web service.
Webservice: [WebService(Namespace = "http://test.ir/")]
call: