FileAuthorizationModule.CheckFileAccessForUser Method
Determines whether the user has access to the requested file.
Assembly: System.Web (in System.Web.dll)
public static function CheckFileAccessForUser( virtualPath : String, token : IntPtr, verb : String ) : boolean
Parameters
- virtualPath
- Type: System.String
The virtual path to the file.
- token
- Type: System.IntPtr
A Windows access token representing the user.
- verb
- Type: System.String
The HTTP verb used to make the request.
Return Value
Type: System.Booleantrue if the current Windows user represented by token has access to the file using the specified HTTP verb or if the FileAuthorizationModule module is not defined in the application's configuration file; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentNullException | virtualPath is a null reference (Nothing in Visual Basic). -or- token is Zero. -or- verb is a null reference (Nothing in Visual Basic). |
| ArgumentException | virtualPath is not in the application directory structure of the Web application. |
| FileNotFoundException | The file specified by virtualPath does not exist. |
The CheckFileAccessForUser method checks to see whether the current user, represented by a Windows access token, is granted access to the requested file in the file-system access-control lists (ACLs). The virtual path is mapped to the physical file-system path before the check is made.
If the HTTP verb used to make the request is GET, POST, or HEAD, the CheckFileAccessForUser method checks for read access to the file. If any other verb is used, the CheckFileAccessForUser method checks for read/write permission to the file.
Security Note If the FileAuthorizationModule module is not defined in the httpModules configuration section for the application, the FileAuthorizationModule module always returns true.
- SecurityPermission
for accessing the requested file. Demand value: Demand. Permission value: Unrestricted.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.