请问那位哥哥(姐姐)知道如何用VB程序修改虚拟目录下的实际路径?

maculasoft 2003-11-22 11:50:14
我现在有一个难题了,就是我的一个程序需要将当前存在虚拟目录下的实际路径更改?如果知道删除虚拟目录也可以?有代码最好了
...全文
19 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
maculasoft 2003-11-24
  • 打赏
  • 举报
回复
龙卷风(白学了,重新充电中) 谢了
请问有没有修改一类的代码啊?
3661512 2003-11-22
  • 打赏
  • 举报
回复
你所说的虚拟目录是指的什么?说清楚点?
online 2003-11-22
  • 打赏
  • 举报
回复
Dim oIIS, oDir, oFile,a
Dim sName, sPath,sName1, sPath1

sPath = 'Enter the path here
sPath1 = 'Enter the path here for the sub Virtual directory
sName = 'Name of the Virtual directory
sName1 = 'Name of the sub Virtual directory

Set oFile = CreateObject("Scripting.FileSystemObject")
Set a = oFile.CreateTextFile("c:\testfile.txt", True)
a.WriteLine(sPath)
a.WriteLine(sName)
Set oIIS = GetObject("IIS://localhost/W3SVC/1/Root")
On Error Resume Next
Set oDir = oIIS.GetObject("IISWebVirtualDir", sName)
' This will return error -2147024893 if it doesn't exist
a.WriteLine(Err.Number)
if Err.Number = 0 Then oIIS.Delete "IISWebVirtualDir", sName
oIIS.SetInfo
a.WriteLine(Err.Number)
If Err.Number <> 0 Then Set oDir = oIIS.Create("IISWebVirtualDir", sName)
a.WriteLine(Err.Number)
oDir.AuthAnonymous = false
Err.Clear
oDir.AccessScript = True
oDir.Path = sPath

'Create the virtual subdirectory
Set oDir = oIIS.Create("IISWebVirtualDir", sName & "/" & sName1)
oDir.AccessRead = True
oDir.AccessWrite = True
oDir.path = sPath1
oDir.SetInfo
oDir.AppCreate True
oDir.SetInfo
a.Close
' Workaround for bug in II4
oDir.KeyType = "IIsWebVirtualDir"

oDir.SetInfo
oDir.AppCreate True
oDir.SetInfo
Set oDir = Nothing
Set oIIS = Nothing
online 2003-11-22
  • 打赏
  • 举报
回复
see the example at

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=Ob59%23ZYdBHA.1488%40tkmsftngp02

7,732

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧