50,523
社区成员
发帖
与我相关
我的任务
分享
class Student : System.Web.Services.WebService
{
private String name;
[WebMethod (EnableSession=true)]
public String getName()
{
return (String)Session["NAME"];
}
[WebMethod (EnableSession=true)]
public void setName(String aName)
{
Session["NAME"] = aName;
}
}
...
localhost.Student student = new localhost.Student();
student.CookieContainer = new System.Net.CookieContainer(); //.net中加这个才可以
student.setName("Lao Wang");
String myInfo = student.getName();
...