blob: 50c8befc4155b696576b40d1743f0676964ab0c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<%@ 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"];
}
}
}
|