会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
sliuqin's Blog
about asp.net2.0...
博客园
首页
新随笔
联系
管理
订阅
Application做的单叶聊天室
aspx代码
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
div
>
<
div style
=
"
z-index: 101; left: 24px; width: 230px; position: absolute; top: 132px;
height: 151px
"
>
&
nbsp;
<
input id
=
"
Text1
"
type
=
"
text
"
name
=
"
mywords
"
/>
<
input id
=
"
Submit1
"
type
=
"
submit
"
value
=
"
submit
"
/></
div
>
</
div
>
</
form
>
</
body
>
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
string
mywords
=
Request[
"
mywords
"
];
Application.Lock();
Application[
"
chat
"
]
=
Application[
"
chat
"
]
+
"
<br>
"
+
mywords;
Response.Write(Application [
"
chat
"
]);
Application.UnLock();
}
}
因为Application是多用户共享的,为了保证在同一时间只有一个用户操作Application对象,程序利用Application.Lock();在操作前对Application对象进行锁定,操作完毕后,进行解锁.
posted @
2007-01-03 01:38
sliuqin
阅读(
625
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告