Microsoft Internet Security and Acceleration Server 2000

Add a Site and Content Rule

The followingportion of Visual Basic code adds a new site and content rule called "Workday Site Restriction". It refers to the "Extended Work Hours" schedule, which you can see in Add a Schedule. The example here also refers to the destination set "Sports Sites" that appeared in the example in Add a Destination Set.

Dim objFPC As New FPCLib.FPC
' declare collection
Dim MySiteAndContentRules As FPCSiteAndContentRules
' declare rule object
Dim objNewSiteAndContentRule As FPCSiteAndContentRule
' get the rule collection of the current array
Set MySiteAndContentRules = objFPC.Arrays.GetContainingArray.ArrayPolicy.SiteAndContentRules
' Add new rule object
Set objNewSiteAndContentRule = MySiteAndContentRules.Add("Workday Site Restriction")
objNewSiteAndContentRule.Description = "Deny sports sites"
objNewSiteAndContentRule.SetDestination fpcSpecifiedDestinationSet, "Sports Sites"
objNewSiteAndContentRule.SetSchedule "Extended Work Hours", fpcArrayScope
objNewSiteAndContentRule.Action = fpcRuleActionDeny
' save your changes
MySiteAndContentRules.Save

Note that the changes will not be saved to persistent storage until the last line of code, where the Save method is called.

See Also

FPCSiteAndContentRule Object, Modify a Site and Content Rule