`

设置session

阅读更多

 

在asp.net的web服务后台代码
    /// <summary>
    /// 设置Session
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    [WebMethod(EnableSession = true)]
    public static bool setSession(string name)
    {
        HttpContext.Current.Session["name"] = System.Web.HttpUtility.UrlDecode(name);
        return true;
    }

    /// <summary>
    /// 获取session
    /// </summary>
    /// <returns></returns>
    [WebMethod(EnableSession = true)]
    public static string getSession()
    {
        return HttpContext.Current.Session["name"].ToString();
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics