UserExists()
            收藏:0  
            阅读:27
        
        
        WebSecurity - UserExists()
定义
UserExists() 方法指示用户是否已存在于 WebSecurity 数据库中。
C# 和 VB 语法
		WebSecurity.UserExists(userName)
	
参数
| 参数 | 类型 | 描述 | 
|---|---|---|
| userName | String | 用户名 | 
返回值
| 类型 | 描述 | 
|---|---|
| Boolean | 如果用户已存在,则返回 true,否则返回 false。 | 
错误和异常
在下面的情况下,任何对 WebSecurity 对象的访问将抛出一个 InvalidOperationException:
- InitializeDatabaseConnection() method has not been called
- SimpleMembership 没有初始化(或者在网站配置中禁用)
备注
UserExists() 方法只验证用户是否已存在于用户资料表中。
它不会为用户验证会员帐户是否已存在,或者用户是否已确认,或者用户是否已登录。
技术数据
| 名称 | 值 | 
|---|---|
| Namespace | WebMatrix.WebData | 
| Assembly | WebMatrix.WebData.dll | 
