' Virtual Directory under which you need to
create the IIsWebFile
vDirName = "IIS://localhost/w3svc/1/root/artinstitutes"
' Getting the Virtual Directory (IIsWebVirDir
object)
Set IIsWebVirtualDirObj = GetObject(vDirName)
' Call the CreateAWebFile function and pass
the IIsWebVirDir object we have with the file name and the redirect
url
CreateAWebFile(IIsWebVirtualDirObj, "test.html",
"/check.asp?id=0")
CreateAWebFile(IIsWebVirtualDirObj, "test1.html","/check.asp?id=1”)
' Commit the changes to
the Metabase
IIsWebVirtualDirObj.SetInfo()
' This function takes 3
arguments
' 1 = IISObject – the
container object
' 2 = filename –
physical FileName which needs to be redirected
' 3 = redirectFileName –
redirect URL
Function
CreateAWebFile(ByVal IISObject, ByVal fileName, ByVal redirectName)
Set myFileCheck =
GetObject(vDirname & "/" &
fileName)
If (Err.Number
<> 0) Then
Set myFile =
IISObject.Create("IIsWebFile",
fileName)
myFile.HttpRedirect = redirectName & " ,PERMANENT"
myFile.SetInfo()
Else
myFileCheck.HttpRedirect = redirectName & " ,PERMANENT"
myFileCheck.SetInfo()
End If
End Function
|