WebSecurity IsCurrentUser method
definition
IsCurrentUser () method provides the user name of the logged user name for comparison.
C # and VB syntax
WebSecurity.IsCurrentUser( userName )
parameter
参数 | 类型 | 描述 |
---|---|---|
userName | String | 要比较的用户名 |
return value
类型 | 描述 |
---|---|
Boolean | 如果 userName 匹配已登录用户,则返回 true ,否则返回 false 。 |
Errors and exceptions
In the following scenario, any access to WebSecurity object will throw an InvalidOperationException:
- InitializeDatabaseConnection () method has not been called
- SimpleMembership not initialized (or disabled in the site configuration)
Technical data
名称 | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |
WebSecurity objects