2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.Web.Services / Test / standalone / server / SessionCounter.asmx
1 <%@ WebService Language="c#" Class="Util.SessionCounter" %>  
2
3  using System;  
4  using System.Web;  
5  using System.Web.Services;  
6  using System.Web.SessionState;  
7  namespace Util
8  {  
9     public class SessionCounter: System.Web.Services.WebService  
10     {  
11                 public SessionCounter ()
12                 {
13                         if (Context == null)
14                                 throw new Exception ("Context not set in constructor");
15                 }
16                 
17          [ WebMethod(EnableSession=true) ]  
18          public void Reset()
19          {  
20             Session["counter"] = 0;
21          }
22         
23          [ WebMethod(EnableSession=true) ]  
24          public int AddOne()  
25          {  
26             if ( Session["counter"] == null )  
27             { Session["counter"]=0; }  
28             else  
29             { Session["counter"]=(int)Session["counter"]+1; }  
30    
31             return (int)Session["counter"];  
32    
33           }
34     }
35   }