UrlAuthorizationModule.CheckUrlAccessForPrincipal Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應