Edit

Share via


UrlAuthorizationModule.CheckUrlAccessForPrincipal Method

Definition

Determines whether the user has access to the requested file.

public:
 static bool CheckUrlAccessForPrincipal(System::String ^ virtualPath, System::Security::Principal::IPrincipal ^ user, System::String ^ verb);
public static bool CheckUrlAccessForPrincipal (string virtualPath, System.Security.Principal.IPrincipal user, string verb);
static member CheckUrlAccessForPrincipal : string * System.Security.Principal.IPrincipal * string -> bool
Public Shared Function CheckUrlAccessForPrincipal (virtualPath As String, user As IPrincipal, verb As String) As Boolean

Parameters

virtualPath
String

The virtual path to the file.

user
IPrincipal

An IPrincipal object representing the current user.

verb
String

The HTTP verb used to make the request.

Returns

true if the current user can access the file; otherwise, false.

Exceptions

virtualPath is null.

-or-

user is null.

-or-

verb is null.

virtualPath is outside of the application root path.

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.

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 checks for read/write access to the file.

For more information and an example Web.config file, see the UrlAuthorizationModule class documentation.

Applies to