[C#] <%@ WebService Language="C#" Class="ServerUsage" %> [Visual Basic] <%@ WebService Language="VB" Class="ServerUsage" %> |
[C#] using System.Web.Services; [Visual Basic] Imports System.Web.Services |
[C#] public class ServerUsage : WebService [Visual Basic] Public Class ServerUsage : Inherits WebService |
[C#] [ WebMethod(EnableSession=true) ] public int PerSessionServiceUsage() [Visual Basic] < WebMethod(EnableSession:=True) > _ Public Function PerSessionServiceUsage() As Integer |
[C#] Session["MyServiceUsage"] = 1; [Visual Basic] Session("MyServiceUsage") = 1 |
[C#] Session["MyServiceUsage"] = ((int) Session["MyServiceUsage"]) + 1; [Visual Basic] Session("MyServiceUsage") = CInt(Session("MyServiceUsage")) + 1 |
[C#] <%@ WebService Language="C#" Class="ServerUsage" %> [Visual Basic] <%@ WebService Language="VB" Class="ServerUsage" %> |
[C#] using System.Web.Services; [Visual Basic] Imports System.Web.Services |
[C#] public class ServerUsage : WebService [Visual Basic] Public Class ServerUsage : Inherits WebService |
[C#] [ WebMethod ] public int PerSessionServiceUsage() [Visual Basic] < WebMethod > _ Public Function PerSessionServiceUsage() As Integer |
[C#] Application["appMyServiceUsage"] = 1; [Visual Basic] Application("appMyServiceUsage") = 1 |
[C#] Application["appMyServiceUsage"] = ((int) Application["appMyServiceUsage"]) + 1; [Visual Basic] Application("appMyServiceUsage") = _ CInt(Application("appMyServiceUsage")) + 1 |
[C#] <%@ WebService Language="C#" Class="ServerUsage" %> using System.Web.Services; public class ServerUsage : WebService { [ WebMethod(Description="Number of times this service has been aclearcase/" target="_blank" >ccessed.") ] public int ServiceUsage() { // If the XML Web service method hasn't been accessed, // initialize it to 1. if (Application["appMyServiceUsage"] == null) { Application["appMyServiceUsage"] = 1; } else { // Increment the usage count. Application["appMyServiceUsage"] = ((int) Application["appMyServiceUsage"]) + 1; } return (int) Application["appMyServiceUsage"]; } [ WebMethod(Description="Number of times a particualr client session has accessed this XML Web service method.",EnableSession=true) ] public int PerSessionServiceUsage() { // If the XML Web service method hasn't been accessed, initialize // it to 1. if (Session["MyServiceUsage"] == null) { Session["MyServiceUsage"] = 1; } else { // Increment the usage count. Session["MyServiceUsage"] = ((int) Session["MyServiceUsage"]) + 1; } return (int) Session["MyServiceUsage"]; } } [Visual Basic] <%@ WebService Language="VB" Class="ServerUsage" %> Imports System.Web.Services Public Class ServerUsage Inherits WebService <WebMethod(Description := "Number of times this service has been accessed.")> _ Public Function ServiceUsage() As Integer ' If the XML Web service method hasn't been accessed, initialize ' it to 1. If Application("appMyServiceUsage") Is Nothing Then Application("appMyServiceUsage") = 1 Else ' Increment the usage count. Application("appMyServiceUsage") = _ CInt(Application("appMyServiceUsage")) + 1 End If Return CInt(Application("appMyServiceUsage")) End Function <WebMethod(Description := "Number of times a particular client session has accessed this XML Web service method.", EnableSession := True)> _ Public Function PerSessionServiceUsage() As Integer ' If the XML Web service method hasn't been accessed, ' initialize it to 1. If Session("MyServiceUsage") Is Nothing Then Session("MyServiceUsage") = 1 Else ' Increment the usage count. Session("MyServiceUsage") = CInt(Session("MyServiceUsage")) + 1 End If Return CInt(Session("MyServiceUsage")) End Function End Class |