SPSecurityContext.SecurityTokenForContext method
Returns credentials that the current user can use to access a resource at a specified location.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function SecurityTokenForContext ( _
context As Uri _
) As SecurityToken
'Usage
Dim context As Uri
Dim returnValue As SecurityToken
returnValue = SPSecurityContext.SecurityTokenForContext(context)
public static SecurityToken SecurityTokenForContext(
Uri context
)
Parameters
context
Type: System.UriA uniform resource identifier (URI).
Return value
Type: System.IdentityModel.Tokens.SecurityToken
Credentials for the current user.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The argument passed to the context parameter is a null reference (Nothing in Visual Basic). |
Remarks
You might use this method in code for a service that needs to act as the currently logged on user when accessing a resource.