All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET,2.0里动态访问META标记_.net资料_编程技术
ASP.NET2.0服务器控件开发之简单属性_[Asp.Net教程]
用ASP+CSS实现网页随机背景_[Html教程]
C#,DataGridView隔行显示不同的颜色_.net资料_编程技术
VB.NET使用OracleTransaction处理事务_[Asp.Net教程]
ASP.NET中的Response对象的方法_.net资料_编程技术
ms,sql,更新表A中某列为表B中的值_mssql学习_编程技术
ASP.NET技巧:在GridView中使用Cache_[Asp.Net教程]
LINQ体验(17)——LINQ,to,SQL语句之动态查询_[Asp.Net教程]
ASP.NET,2.0移动开发之定义设备筛选器_.net资料_编程技术
Reading number is top 10 pictures
From China fortress sora aoi1
More attractive than sora aoi4
牛奶和人奶哪个好?
Li Zongrui hunting video screenshots1
七步解决性冷淡
Summer is most suitable for young people to travel in China9
这才是真正的人体艺术3
Startling Russian girl blind date scene3
邪恶搞笑内涵图
两个妞在等世界上最短的火车
Download software ranking
Boxer Classic video1
matrix2
Sora aoi 120 minutes
Unix video tutorial19
asp.net技术内幕
WebService在.NET中的实战应用教学视频 → 第1集
The Bermuda triangle2
linux安装大全
C#程序员参考手册
虚拟机汉化软件
delv published in(发表于) 2014/1/16 9:30:27 Edit(编辑)
Webservice中使用Session、Application_[Asp.Net教程]

Webservice中使用Session、Application_[Asp.Net教程]

Webservice中使用Session、Application_[Asp.Net教程]

在Asp.Net 2.0里,已经能够在WebMethod里使用 Session 、 Application 这种服务器变量了。

一、Session [WebMethod(EnableSession = true)]
public string Hello()
{
return "Hello," + Session["user"];
}

[WebMethod(EnableSession = false)]
public string Hello1()
{
return "Hello," + Session["user"];
}

[WebMethod]
public string Hello2()
{
return "Hello," + Session["user"];
}
“EnableSession” 为 XML Web services 方法启用会话状态,启用为 true。默认状态为 false。

以上三种方式均能实现对Session变量的使用。但要注意:
如果状态设置为 true,则客户端访问WS时,可以不赋值Session变量,有默认值。
如果状态设置为 false,则客户端访问WS时,必须要先对Session变量赋值,否则报错。

二、Application
[WebMethod]
public string Hello3()
{
return "Hello," + Application["user"];
}
使用Application时,不需要设置方法标签



http://www.cnblogs.com/heekui/archive/2007/01/10/616513.html








添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.