MoveDown Method of the IFPCUserAgentMappings Interface

The MoveDown method moves the specified User-Agent mapping one step down the list of User-Agent mappings, which corresponds to the order in which the User-Agent mappings are tested to find a mapping that matches the User-Agent header in a request. If the first mapping in the list does not match the User-Agent header in a request, the second mapping is tested, and so on.

[C++]

Syntax

HRESULT MoveDown(
  [in]  long index
);

Parameters

index

Required. Index (the current position indicated by the Order property of the IFPCUserAgentMapping interface) of the User-Agent mapping to move down.

Return Value

This method returns S_OK if the call is successful; otherwise, it returns an error code.
[Visual Basic]

Syntax

Sub MoveDown( _
  ByVal index As Long _
)

Parameters

index

Required. Index (the current position indicated by the Order property of the FPCUserAgentMapping object) of the User-Agent mapping to move down.

Return Value

This method has no return values. If the call is unsuccessful, an error is raised that can be intercepted by using an error handler.

Example Code

This VBScript script moves the specified User-Agent mapping one step down the list of User-Agent mappings.
Option Explicit
 
' Define the constant needed.
Const Error_TypeMismatch = &HD
const Error_InvalidParameter = &H80070057
 
Main(WScript.Arguments)
 
Sub Main(args)
	If(args.Count <> 1) Then
		Usage()
	Else
	 MoveDownMapping args(0)
	End If
End Sub
 
Sub MoveDownMapping(mappingId)
 
	' Create the root object.
	Dim root  ' The FPCLib.FPC root object
	Set root = CreateObject("FPC.Root")
 
	' Declare the other objects needed.
	Dim isaArray	' An FPCArray object
	Dim mappings	' An FPCUserAgentMappings collection
	' Get references to the array object and
	' the User-Agent mappings collection.
	Set isaArray = root.GetContainingArray()
	Set mappings = isaArray.RuleElements.UserAgentMappings
 
	' Move down the specified User-Agent mapping.
	On Error Resume Next
	mappings.MoveDown(CInt(mappingId))
	If Err.Number = Error_TypeMismatch Then
		WScript.Echo "The Mapping parameter specified is not a number."
		WScript.Quit
	ElseIf Err.Number = Error_InvalidParameter Then
		WScript.Echo "The mapping specified cannot be moved or does not exist."
		WScript.Quit
	Else
		WScript.Echo "Moving the User-Agent mapping specified down..."
	End If
	On Error GoTo 0
 
	' Save the changes to the collection of User-Agent mappings.
	mappings.Save
	WScript.Echo "Done!"
End Sub
 
Sub Usage()
	WScript.Echo "Usage:" & VbCrLf _
		& "  " & WScript.ScriptName & " Mapping" & VbCrLf _
		& "" & VbCrLf _
		& "  Mapping   Number of the mapping." 
	WScript.Quit
End Sub

Remarks

Use the MoveUp method to move a User-Agent mapping one step up the list of User-Agent mappings.

Requirements

Client Requires Windows Vista or Windows XP.
Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).
IDL

Declared in Msfpccom.idl.

DLL

Requires Msfpccom.dll.

See Also

FPCUserAgentMappings


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.