145 lines
5.0 KiB
HTML
145 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>DomainGrant</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_domaingrant"></A><SUP></SUP>DomainGrant</H3>
|
|
|
|
<P>You can use the <B>DomainGrant</B> property of the <A HREF="/iishelp/iis/htm/asp/aore0ard.htm"><B>IIsIPSecurity</B></A> object to edit lists of domains that are allowed access to the server.</P>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><I>SecObj</I>.<B>DomainGrant</B> = <I>Domain</I> </P>
|
|
|
|
<P><I>varDomainGrant = SecObj</I>.<B>DomainGrant</B></P>
|
|
|
|
<P> </P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>SecObj</I></DT>
|
|
|
|
<DD>An IIS Admin Object of type <B>IIsIPSecurity</B>.<BR>
|
|
</DD>
|
|
|
|
<DT><I>Domain</I></DT>
|
|
|
|
<DD>This is the domain you want granted access to the server.</DD>
|
|
</DL>
|
|
|
|
<H6>Code Example</H6>
|
|
|
|
<P><CODE><%</CODE></P>
|
|
|
|
<P><CODE> ' Remember to enable Integrated Windows Authentication and </CODE></P>
|
|
|
|
<P><CODE> ' disable Anonymous Access or you will get and Server 500 error.</CODE></P>
|
|
|
|
<P><CODE> Dim SecObj </CODE></P>
|
|
|
|
<P><CODE> Dim MyIPSec</CODE></P>
|
|
|
|
<P><CODE> Dim DomainList</CODE></P>
|
|
|
|
<P><CODE> </CODE></P>
|
|
|
|
<P><CODE> ' Get the IIS object that holds the info for the default site. </CODE></P>
|
|
|
|
<P><CODE> ' This could be any site root/vdir, or IIS://LocalHost/W3SVC for global </CODE></P>
|
|
|
|
<P><CODE> ' properties.</CODE></P>
|
|
|
|
<P><CODE> Set SecObj = GetObject("IIS://LocalHost/W3SVC/1/Root") </CODE></P>
|
|
|
|
<P><CODE> ' Get the IIsIPSecurity object</CODE></P>
|
|
|
|
<P><CODE> Set MyIPSec = SecObj.IPSecurity</CODE></P>
|
|
|
|
<P><CODE> ' Make sure GrantByDefault=FALSE or your changes will not count </CODE></P>
|
|
|
|
<P><CODE> If (TRUE = MyIPSec.GrantByDefault) Then</CODE></P>
|
|
|
|
<P><CODE>Response.Write </CODE></P>
|
|
|
|
<P><CODE> "<BR>GrantByDefault was not FALSE. Setting to FALSE.<BR>"</CODE></P>
|
|
|
|
<P><CODE>MyIPSec.GrantByDefault = FALSE</CODE></P>
|
|
|
|
<P><CODE> End If</CODE></P>
|
|
|
|
<P><CODE> </CODE></P>
|
|
|
|
<P><CODE> ' Get the Grant list, as an array, and add your new allowed domain</CODE></P>
|
|
|
|
<P><CODE> DomainList = MyIPSec.DomainGrant</CODE></P>
|
|
|
|
<P><CODE> Redim DomainList (Ubound(DomainList)+1)</CODE></P>
|
|
|
|
<P><CODE> DomainList (Ubound(DomainList)) = "somedomain.com"</CODE></P>
|
|
|
|
<P><CODE> ' Set the new lists back in the metabase in two stages, and then set </CODE></P>
|
|
|
|
<P><CODE> ' the metabase</CODE></P>
|
|
|
|
<P><CODE> MyIPSec.DomainGrant = DomainList</CODE></P>
|
|
|
|
<P><CODE> SecObj.Setinfo</CODE></P>
|
|
|
|
<P><CODE> </CODE></P>
|
|
|
|
<P><CODE> Response.Write "The IPRestriction has been set<BR>"</CODE></P>
|
|
|
|
<P><CODE>%></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/aore588k.htm"><B>GrantByDefault</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">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|