Files
mono/mcs/class/System.Web.Services/Test/standalone/server/SessionCounter.asmx
T
2004-08-25 08:54:35 +00:00

36 lines
854 B
Plaintext

<%@ WebService Language="c#" Class="Util.SessionCounter" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.SessionState;
namespace Util
{
public class SessionCounter: System.Web.Services.WebService
{
public SessionCounter ()
{
if (Context == null)
throw new Exception ("Context not set in constructor");
}
[ WebMethod(EnableSession=true) ]
public void Reset()
{
Session["counter"] = 0;
}
[ WebMethod(EnableSession=true) ]
public int AddOne()
{
if ( Session["counter"] == null )
{ Session["counter"]=0; }
else
{ Session["counter"]=(int)Session["counter"]+1; }
return (int)Session["counter"];
}
}
}