July 2000
Intermediate to advanced
492 pages
14h 53m
English
HasAccess —
objPermChkr.
HasAccess(
strPath
)
Determines whether the current user has access to the file specified
in the strPath argument. The return value
is a Boolean.
strPath
A string value that represents the relative path to the file to which you are determining accessibility. This path can be a virtual or a physical path.
<%
' Declare local variables.
Dim objPermChkr
Dim blnPermission
' Instantiate a Permission Checker object.
Set objPermChkr = Server.CreateObject( _
"IISSample.PermissionChecker")
' Determine whether the current user has access to the
' security page using a virtual path.
blnPermission = objPermChkr.HasAccess("/Apps/SecPage.asp")
' Determine whether the current user has access to the
' security page using a physical path.
blnPermission = objPermChkr.HasAccess( _
"c:\inetpub\wwwroot\Apps\SecPage.asp")
. . . [addition code]' You can then use the results of these tests to determine ' whether or not to create a hyperlink to the restricted ' page If blnPermission Then %> Congratulations, you have access to the security page. <A HREF = "/Apps/SecPage.asp">Security Page</A> <% End If %>
If the file does not exist, the call to HasAccess returns a value of
False.
Read now
Unlock full access