标签:des style blog http io ar color os 使用
默认情况下,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(); } }
标签:des style blog http io ar color os 使用
原文地址:http://www.cnblogs.com/gossip/p/4132006.html