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


    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Services;

    namespace LTEServices
    {
    /// <summary>
    /// HandoverServices 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
    // [System.Web.Script.Services.ScriptService]
    public class HandoverServices : System.Web.Services.WebService
    {

    [WebMethod]
    public string HelloWorld()
    {
    return "Hello World";
    }
    #region 通用方法
    [WebMethod(Description="方法执行后的消息",EnableSession=true)]
    public string GetMessage()
    {
    string message = Session["Message"] as string;
    return message;
    }
    [WebMethod(Description="把执行完方法后返回的消息写入session", EnableSession=true)]
    public void SetMessage(string key,string message)
    {
    //给Session设置一个唯一Key
    //规则:GUID+一个字符串
    Session["Message"] = "测试WebServices使用Session";
    }

    #endregion
    }
    }

  • 相关阅读:
    hh
    SDUT 3923 打字
    最短路
    阶乘后面0的个数(51Nod 1003)
    大数加法
    Biorhythms(中国剩余定理)
    usaco-5.1-theme-passed
    usaco-5.1-starry-passed
    usaco-5.1-fc-passed
    usaco-4.4-frameup-passed
  • 原文地址:https://www.cnblogs.com/TBhome/p/4335672.html
Copyright © 2011-2022 走看看