.net中WebService如何使用Session

在webService里面Session默认是不可用的,必须得开启Session才能使用,如
[WebMethod(EnableSession = true)]
public string Login(string name)
{
    Context.Session["name"] = name;
    return name;
}
需要在当前方法上启用Session  [WebMethod(EnableSession = true)]

 

另外参见

http://www.cnblogs.com/hoojo/archive/2011/03/16/1985699.html
posted @ 2012-02-02 14:08  子福当自强  阅读(293)  评论(0编辑  收藏  举报
悟道