ASP.NET 教程教程
WebSecurity IsCurrentUser 方法
WebSecurity IsCurrentUser 方法
WebSecurity - IsCurrentUser()

定义
IsCurrentUser() 方法把提供的用户名与已登录用户的用户名进行比较。
C# 和 VB 语法
WebSecurity.IsCurrentUser(userName)
参数
| 参数 | 类型 | 描述 |
|---|---|---|
| userName | String | 要比较的用户名 |
返回值
| 类型 | 描述 |
|---|---|
| Boolean | 如果 userName 匹配已登录用户,则返回 true,否则返回 false。 |
错误和异常
在下面的情况下,任何对 WebSecurity 对象的访问将抛出一个 InvalidOperationException:
- InitializeDatabaseConnection() 方法没有被调用
- SimpleMembership 没有初始化(或者在网站配置中禁用)
技术数据
| 名称 | 值 |
|---|---|
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |

| WebSecurity IsCurrentUser 方法 |
|---|
ASP.NET 教程
ASP.NET 是微软公司提出的一个使用 HTML、CSS、JavaScript 和服务器脚本创建网页和网站的开发框架。ASP.NET 支持三种不同的开发模式:单页面模式、MVC 模式、事件驱动模式。
加载中,请稍侯......