zoukankan      html  css  js  c++  java
  • WebServices中使用Session

    默认情况下,Asp.net使用cookie来管理会话状态。因此,Asp.net假设客户端存储了会话cookie并将它与每一个请求一并发回给客户端。

     /// <summary>
        /// Summary description for WebMethodSession
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        // [System.Web.Script.Services.ScriptService]
        public class WebMethodSession : System.Web.Services.WebService
        {
    
            [WebMethod(EnableSession = true)]
            public void SaveInSession(string msg)
            {
                Session["Msg"] = msg;
            }
    
            [WebMethod(EnableSession = false)]
            public string GetFromSession()
            {
                return Session["Msg"].ToString();
            }
        }
  • 相关阅读:
    软件测试人员的要求
    冒烟测试和回归测试的区别
    [go]struct
    [go]socket编程
    [go]gorhill/cronexpr用go实现crontab
    [go]os/exec执行shell命令
    [go]time包
    [go]etcd使用
    [go]redis基本使用
    [go]go操作mysql
  • 原文地址:https://www.cnblogs.com/gossip/p/4132006.html
Copyright © 2011-2022 走看看