User-594116948 posted
hi to all ...thank in advance ..i am trying to main state in web service ..but not getting actual o/P and every time going as fresh request
SERVICE:
----------
[WebMethod(EnableSession = true)]
public int IncSessionCounter()
{
int counter;
if (Context.Session["Counter"] == null)
{
counter = 1;
}
else
{
counter =Convert.ToInt32(Context.Session["Counter"].ToString() )+ 1;
}
Context.Session["Counter"] = counter;
return counter;
}
Client
-------
protected void Button1_Click(object sender, EventArgs e)
{
ServiceReference1.Service1SoapClient o = new Service1SoapClient();
int k = o.IncSessionCounter();
}
when First time i clicked button k =1 getting ..
second time also getting K=1 (as fersh request ) How to get incremented vlaue as 2 when second time clicked?