在PHP我曾经使用过
session_start();
if(isset(SESSION["user"]))
{
//session is set
}
els{
// there is no session
}
Run Code Online (Sandbox Code Playgroud)
但我在asp.net中这样做吗?我的意思是.什么代码可以告诉会话设置与否
例如:asp.net c#
//login.aspx
SESSION["USER"];
//user_profile.aspx
if(SESSION["USER"])// how do i validate that??
{
}
Run Code Online (Sandbox Code Playgroud)
jTC*_*jTC 22
SESSION["USER"]; //this should throw an error since it's not setting a value and not a method.
Run Code Online (Sandbox Code Playgroud)
您可以像这样测试会话值:
if (Session["USER"] != null)
{
//do something interesting
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31276 次 |
| 最近记录: |