Microsoft Internet Security and Acceleration Server 2000

Preventing Site Access for an Enterprise

The following portion of Visual Basic code adds a new site and content rule, called "Emergency_Site_Restriction", on the enterprise level. The rule serves only one function, to limit access to a particular site; for example, www.sitetoblock.tld.

Dim objFPC As New FPCLib.FPC
Dim rules As FPCSiteAndContentRules
Dim rule As FPCSiteAndContentRule
Dim destinationset As fpcDestinationSet

'Get the destination sets collection
Set DestinationSets = objFPC.Enterprise.PolicyElements.DestinationSets
'Add a destination set called "Emergency"
Set destinationset = DestinationSets.Add("Emergency")
'Add a destination called "www.sitetoblock.tld"
Set destination = destinationset.Add("www.sitetoblock.tld")
'Save the destination set
destinationset.Save

'Get the Site and Content Rules collection
Set rules = objFPC.Enterprise.EnterprisePolicies(1).SiteAndContentRules
'Add a rule called "Emergency_Site_Restriction"
Set rule = rules.Add("myrule")
'Define the rule action to deny access
rule.Action = fpcRuleActionDeny
'Define that the rule applies to all users, which is the default
rule.AppliesToMethod = fpcAppliesToAll
'Define that the rule applies to all users, which is the default
rule.AppliesToContentMethod = fpcAppliesToAllContent
'Define that the rule always applies
rule.SetAppliesAlways
'Set the destination to which the rule applies
rule.SetDestination fpcSpecifiedDestinationSet, "Emergency", fpcArrayScope
'Save the rule
rule.Save