WebSecurity GetUserId method
WebSecurity objects
definition
GetUserId () method returns the specified user ID.
C # and VB syntax
WebSecurity.GetUserId( userName )
parameter
参数 | 类型 | 描述 |
---|---|---|
userName | String | 用户名 |
return value
类型 | 描述 |
---|---|
Integer |
用户 ID |
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)
Remark
User ID is the primary key of user information stored in the user database.
It is used to identify the user in the user table and membership table.
Technical data
名称 | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |
WebSecurity objects