125 lines
4.1 KiB
HTML
125 lines
4.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>HasAccess</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H2><A NAME="_hasaccess"></A><SUP></SUP>HasAccess</H2>
|
|
|
|
<P>The <B>HasAccess</B> method tests whether a user has permission to access a specified file.</P>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><I>OVar</I><B>.HasAccess( </B><I>FilePath </I><B>)</B></P>
|
|
|
|
<P><B> </B></P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>FilePath</I></DT>
|
|
|
|
<DD>A string that specifies the path and name of the file; this can be either a physical or virtual path. </DD>
|
|
</DL>
|
|
|
|
<H6>Return Values</H6>
|
|
|
|
<P>Returns a BOOLEAN value that indicates whether the Web user has access to the specified file. If the file does not exist, or if a directory is specified, the <B>PermissionChecker</B> object returns False.</P>
|
|
|
|
<H6>Example</H6>
|
|
|
|
<P>The following example uses the <B>PermissionChecker</B> object to test whether the Web user has access to the file C:\pages\private\default.htm. If the user has access, the script creates a hyperlink to that file; otherwise it writes a message. This example uses a virtual path.</P>
|
|
|
|
<P>--- PermChecker.asp ---</P>
|
|
|
|
<PRE><CODE><%
|
|
If "" = Request.ServerVariables("LOGON_USER") Then
|
|
|
|
Response.Write "<H3>Please disable Anonymous Access for this Virtual Directory</H3>"
|
|
|
|
Else
|
|
|
|
Set oPermChecker = Server.CreateObject("MSWC.PermissionChecker")
|
|
%>
|
|
|
|
<H3>Checking Permissions</H3>
|
|
|
|
|
|
|
|
<P>Logged On User =
|
|
<%=Request.ServerVariables("LOGON_USER")%>
|
|
|
|
<P>
|
|
Access to Physical Path
|
|
<%=Request.ServerVariables("PATH_TRANSLATED")%>
|
|
=
|
|
<%=oPermChecker.HasAccess(Request.ServerVariables("PATH_TRANSLATED"))%>
|
|
|
|
<P>
|
|
Access to Virtual Path
|
|
<%=Request.ServerVariables("PATH_INFO")%>
|
|
=
|
|
<%=oPermChecker.HasAccess(Request.ServerVariables("PATH_INFO"))%>
|
|
|
|
<P>
|
|
If you have access to
|
|
http://<%=Request.ServerVariables("SERVER_NAME")%>/iissamples/sdk/asp/simple/Variables_VBScript.asp
|
|
then you will see a link below:<BR>
|
|
|
|
<%
|
|
If oPermChecker.HasAccess("/iissamples/sdk/asp/simple/Variables_VBScript.asp") Then
|
|
%>
|
|
<A href="http://localhost/iissamples/sdk/asp/simple/Variables_VBScript.asp">
|
|
http://localhost/iissamples/sdk/asp/simple/Variables_VBScript.asp
|
|
</A>
|
|
<%
|
|
End If
|
|
|
|
End if
|
|
%>
|
|
</CODE></PRE>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|