📄 sessionservice1.asmx
字号:
<%@ WebService Language="C#" Class="SessionService1" %>
using System;
using System.Web.Services;
public class SessionService1 : WebService {
[ WebMethod(EnableSession=true) ]
public String UpdateHitCounter() {
if (Session["HitCounter"] == null) {
Session["HitCounter"] = 1;
}
else {
Session["HitCounter"] = ((int) Session["HitCounter"]) + 1;
}
return "这是您第 " + Session["HitCounter"].ToString() + " 次访问该服务。";
}
[ WebMethod(EnableSession=false)]
public String UpdateAppCounter() {
if (Application["HitCounter"] == null) {
Application["HitCounter"] = 1;
}
else {
Application["HitCounter"] = ((int) Application["HitCounter"]) + 1;
}
return "这是您第 " + Application["HitCounter"].ToString() + " 次访问该服务。";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -