在WebService方法中使用Session
来源:互联网 发布:右下角网络连接红叉 编辑:程序博客网 时间:2024/06/04 20:01
aspx页面
<asp:ScriptManager runat="server" ID="ScriptManager1" ScriptMode="Debug"><Services><asp:ServiceReference Path="Services/EnableSessionService.asmx" InlineScript="true" /></Services></asp:ScriptManager> <input type="button" value="Add One" onclick="addOne()" /><script language="javascript" type="text/javascript">function addOne(){EnableSessionService.AddOne(onSucceeded);}function onSucceeded(result){alert(result);}</script>
EnableSessionService.asmx页面
<%@ WebService Language="C#" Class="EnableSessionService" %>using System;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Web.Script.Services;using System.Web.SessionState;[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][ScriptService]public class EnableSessionService : System.Web.Services.WebService{ [WebMethod(EnableSession = true)]//需要添加的标记及属性EnableSession=true public int AddOne(){HttpSessionState session = HttpContext.Current.Session;//创建一个session对像object objValue = session["value"];int value = objValue == null ? 0 : (int)objValue;value++;session["value"] = value;return value; } }
- 在WebService方法中使用Session
- 在WebService方法中使用Session
- 在webservice中使用session
- webservice中使用session的方法
- 在asp.net webservice中如何使用session
- 在asp.net webservice中如何使用session
- 在asp.net webservice中如何使用session
- 在asp.net webservice中如何使用session
- Webservice中使用Session、Application
- Webservice中使用Session、Application
- Laravel 在构造方法中使用session
- .net中WebService如何使用Session
- 在 WebService 中使用属性发布一个方法
- 在WebService中使用Session的问题 http://www.x2blog.cn/BoyTNT/?tid=6599
- 怎样在自定义HTTPHANDLER中使用SESSION的方法?
- 在 WebService 中使用属性
- 在WebService中使用Timer
- 在WebService中使用Timer
- 写在最前面
- 如何在XP机器上安装Linux虚拟机
- db2之in和exist的性能区别
- linux下 XML 的学习总结
- 12 个有效的提高编程技能的方法
- 在WebService方法中使用Session
- 十条不错的编程观点
- linux 指令大全
- 在WebService方法中反回XML对象
- 5大迹象显示你应该当场聘用程序员
- [Script]List of Scheduled Concurrent Programs
- VC无法设置断点,断点失效问题
- (C#)如何利用Graphics画出一幅图表
- 程序员编程生产力相差10倍意味着什么?