### GrantByDefault

You can use the GrantByDefault property of the IIsIPSecurity object to set how you would like to specify server access. GrantByDefault is a Boolean property which determines whether the default setting is grant all with exceptions or deny all with exceptions. If GrantByDefault is TRUE, then all IP addresses and domains are granted access to the server (with the exception of the list entries of the DomainDeny and IPDeny methods). If GrantByDefault is FALSE, then all IP addresses and domains are denied access to the server (with the exception of the list entries of the DomainGrant and IPGrant methods).

###### Syntax

SecObj.GrantByDefault Boolean

###### Parameters

SecObj
  An IIS Admin Object of type IIsIPSecurity.
Boolean
  This is a value of TRUE or FALSE.

###### Code Example

`<%`

`' Remember to enable Integrated Windows Authentication and`

`' disable Anonymous Access or you will get and Server 500 error.`

`Dim SecObj`

`Dim MyIPSec`

``

`' Get the IIS object that holds the info for the default site.`

`' This could be any site root/vdir, or IIS://LocalHost/W3SVC for global`

`' properties.`

`Set SecObj = GetObject("IIS://LocalHost/W3SVC/1/Root")`

`' Get the IIsIPSecurity object`

`Set MyIPSec = SecObj.IPSecurity`

`If (TRUE = MyIPSec.GrantByDefault) Then`

`Response.Write`

`"<BR>GrantByDefault was set to TRUE. Setting to FALSE.<BR>"`

`MyIPSec.GrantByDefault = FALSE`

`Else 'If (FALSE = MyIPSec.GrantByDefault) Then`

`Response.Write`

`"<BR>GrantByDefault was set to FALSE. Setting to TRUE.<BR>"`

`MyIPSec.GrantByDefault = TRUE`

`End If`

``

`' Set the info in the database`

`SecObj.IPSecurity = MyIPSec`

`SecObj.Setinfo`

`%>`

###### See Also

IPDeny, IPGrant, DomainDeny, DomainGrant, IIsIPSecurity

© 1997-2001 Microsoft Corporation. All rights reserved.