I developed a Web Service in c# and I tried to use session. I copied
the example from MSDN
[WebMethod(EnableSession = true)]
public int Test()
{
if (Session["HitCounter"] == null)
{
Session["HitCounter"] = 1;
}
else
{
Session["HitCounter"] = ((int)Session["HitCounter"]) + 1;
}
return ((int)Session["HitCounter"]);
}
then I wrote an Symple C# windows application, I linked a Web Reference
and on a button
I put
private void button1_Click(object sender, EventArgs e)
{
ServNav serv = new ServNav(); //
button1.Text = serv.Test().ToString();
}
Now I obtain always 1.
If I change Session with Application, all works fine.
Where is the error? Have you any idea ?
Thanks