asp.net.ph

UrlAuthorizationModule.CheckUrlAccessForPrincipal Method

System.Web.Security Namespace   UrlAuthorizationModule Class


.NET Framework version 2.0

Determines whether the user has access to the requested file.

[ VB ]
Public Shared Function CheckUrlAccessForPrincipal ( _
   virtualPath As String, _
   user As IPrincipal, _
   verb As String _
 ) As Boolean

[ C# ]
public static bool CheckUrlAccessForPrincipal (
   string virtualPath,
   IPrincipal user,
   string verb
);

[ C++ ]
public: static bool CheckUrlAccessForPrincipal (
   string* virtualPath,
   IPrincipal* user,
   string* verb
);

[ JScript ]
public static function CheckUrlAccessForPrincipal (
   virtualPath : string,
   user : IPrincipal,
   verb : string
 ) : Boolean;

Parameters

virtualPath
The virtual path to the file.
user
An IPrincipal object representing the current user.
verb
The HTTP verb used to make the request.

Return Value

This method returns only a boolean value: true if the current user has access to the file using the specified HTTP verb; otherwise false.

Exceptions


Exception Type Condition
ArgumentNullException virtualPath is a null reference ( Nothing in Visual Basic ) .

or

user 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.

Remarks

The CheckUrlAccessForPrincipal method checks to see whether the current user is granted access to the requested file in the Web.config file for the application. 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 CheckUrlAccessForPrincipal method checks for read access to the file. If any other verb is used, the CheckUrlAccessForPrincipal method checks for read/write permission to the file.

Security Note: If the UrlAuthorizationModule is not defined in the httpModules configuration section for the application, the UrlAuthorizationModule always returns true.

See Also

UrlAuthorizationModule Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph