System.Web.Security Namespace FileAuthorizationModule Class
.NET Framework version 2.0
Determines whether the user has access to the requested file.
[ VB ]
Public Shared Function CheckFileAccessForUser ( _
virtualPath As String, _
token As IntPtr, _
verb As String _
) As Boolean
[ C# ]
public static bool CheckFileAccessForUser (
string virtualPath,
IntPtr token,
string verb
);
[ C++ ]
public: static bool CheckFileAccessForUser (
string* virtualPath,
IntPtr* token,
string* verb
);
[ JScript ]
public static function CheckFileAccessForUser (
virtualPath : string,
token : IntPtr,
verb : string
) : Boolean;
- virtualPath
- The virtual path to the file.
- token
- A Windows access token representing the user.
- verb
- The HTTP verb used to make the request.
This method returns only a boolean value: true if the current Windows user represented by token has access to the file using the specified HTTP verb or if the FileAuthorizationModule is not defined in the application's configuration file; otherwise false.
Exception Type |
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 is not defined in the httpModules configuration section for the application, the FileAuthorizationModule always returns true.
FileAuthorizationModule Members