2025-04-27 07:49:33 -04:00

133 lines
5.0 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>GrantByDefault</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">
<H3><A NAME="_k2_grantbydefault"></A><SUP></SUP>GrantByDefault</H3>
<P>You can use the <B>GrantByDefault</B> property of the <A HREF="/iishelp/iis/htm/asp/aore0ard.htm"><B>IIsIPSecurity</B></A> object to set how you would like to specify server access. <B>GrantByDefault</B> is a Boolean property which determines whether the default setting is grant all with exceptions or deny all with exceptions. If <B>GrantByDefault</B> is TRUE, then all IP addresses and domains are granted access to the server (with the exception of the list entries of the <B>DomainDeny</B> and <B>IPDeny</B> methods). If <B>GrantByDefault</B> is FALSE, then all IP addresses and domains are denied access to the server (with the exception of the list entries of the <B>DomainGrant</B> and <B>IPGrant</B> methods).</P>
<H6>Syntax</H6>
<P><I>SecObj</I>.<B>GrantByDefault</B> <I>Boolean</I> </P>
<P>&nbsp;</P>
<H6>Parameters</H6>
<DL>
<DT><I>SecObj</I></DT>
<DD>An IIS Admin Object of type <B>IIsIPSecurity</B>.<BR>
</DD>
<DT><I>Boolean</I></DT>
<DD>This is a value of TRUE or FALSE.</DD>
</DL>
<H6>Code Example</H6>
<P><CODE>&lt;%</CODE></P>
<P><CODE>&nbsp;&nbsp;' Remember to enable Integrated Windows Authentication and</CODE></P>
<P><CODE>&nbsp;&nbsp;' disable Anonymous Access or you will get and Server 500 error.</CODE></P>
<P><CODE>&nbsp;&nbsp;Dim SecObj </CODE></P>
<P><CODE>&nbsp;&nbsp;Dim MyIPSec</CODE></P>
<P><CODE>&nbsp;&nbsp;</CODE></P>
<P><CODE>&nbsp;&nbsp;' Get the IIS object that holds the info for the default site.</CODE></P>
<P><CODE>&nbsp;&nbsp;' This could be any site root/vdir, or IIS://LocalHost/W3SVC for global </CODE></P>
<P><CODE>&nbsp;&nbsp;' properties.</CODE></P>
<P><CODE>&nbsp;&nbsp;Set SecObj = GetObject("IIS://LocalHost/W3SVC/1/Root") </CODE></P>
<P><CODE>&nbsp;&nbsp;' Get the IIsIPSecurity object</CODE></P>
<P><CODE>&nbsp;&nbsp;Set MyIPSec = SecObj.IPSecurity</CODE></P>
<P><CODE>&nbsp;&nbsp;If (TRUE = MyIPSec.GrantByDefault) Then</CODE></P>
<P><CODE>Response.Write </CODE></P>
<P><CODE>&nbsp;&nbsp;"&lt;BR&gt;GrantByDefault was set to TRUE.&nbsp; Setting to FALSE.&lt;BR&gt;"</CODE></P>
<P><CODE>MyIPSec.GrantByDefault = FALSE</CODE></P>
<P><CODE>&nbsp;&nbsp;Else 'If (FALSE = MyIPSec.GrantByDefault) Then</CODE></P>
<P><CODE>Response.Write </CODE></P>
<P><CODE>&nbsp;&nbsp;"&lt;BR&gt;GrantByDefault was set to FALSE.&nbsp; Setting to TRUE.&lt;BR&gt;"</CODE></P>
<P><CODE>MyIPSec.GrantByDefault = TRUE</CODE></P>
<P><CODE>&nbsp;&nbsp;End If</CODE></P>
<P><CODE>&nbsp;&nbsp;</CODE></P>
<P><CODE>&nbsp;&nbsp;' Set the info in the database</CODE></P>
<P><CODE>&nbsp;&nbsp;SecObj.IPSecurity = MyIPSec</CODE></P>
<P><CODE>&nbsp;&nbsp;SecObj.Setinfo</CODE></P>
<P><CODE>%&gt;</CODE></P>
<PRE><CODE> </CODE></PRE>
<H6>See Also</H6>
<P><A HREF="/iishelp/iis/htm/asp/aore05ix.htm"><B>IPDeny</B></A>, <A HREF="/iishelp/iis/htm/asp/aore0hro.htm"><B>IPGrant</B></A>, <A HREF="/iishelp/iis/htm/asp/aore97cp.htm"><B>DomainDeny</B></A>, <A HREF="/iishelp/iis/htm/asp/aore9qpg.htm"><B>DomainGrant</B></A>, <A HREF="/iishelp/iis/htm/asp/aore0ard.htm"><B>IIsIPSecurity</B></A></P>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>