如何"Session.Abandon()"?从WebMethod [英] How to "Session.Abandon()" from WebMethod

查看:65
本文介绍了如何"Session.Abandon()"?从WebMethod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[WebMethod]
public static void AppOff()
{
  Session.Abandon();
}



没有任何建议吗?
谢谢:)



It didn''t work any suggestions?
Thank you :)

推荐答案

看看EnableSession是WebMethod属性的一部分

Have a look at EnableSession as part of the WebMethod attribute

// C#
public class Service1 : System.Web.Services.WebService
{
    [System.Web.Services.WebMethod(EnableSession=true)]
    public double ConvertTemperature(double dFahrenheit)
    {
       Session["Conversions"] = (int) Session["Conversions"] + 1;
       double temperature = ((dFahrenheit - 32) * 5) / 9;

       Session.Abandon();
       return temperature;
    }
}


这篇关于如何"Session.Abandon()"?从WebMethod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆