选择显示字体大小

用adsi编程实现iis中建立虚拟目录

conn.asp不再贴出。
这里从数据库中读出目录名


<!--#include file="conn.asp"-->
<%
'response.end  '//这是做调试时用的
on error resume next
set rs=server.createobject("adodb.recordset")
rs.activeconnection = myconnection
sql="select * from 你的表名 where 你指定的条件"
rs.open sql,,1,2
if rs.eof then response.end '//如果无符合条件记录,则停止
rs.movefirst
dim namestr    '//定义虚拟目录名变量
do while not rs.eof
if instr(1,namestr,server.htmlencode(trim(rs("suname"))))<>0 then rs.movenext
name=name&server.htmlencode(trim(rs("suname")))
%>
<%
scomputer ="localhost"
sphydir = "x:\test\" & server.htmlencode(trim(rs("suname")))   '//这里定义虚拟目录指向的物理路径
svirdir = server.htmlencode(trim(rs("suname"))) '//这里定义虚拟目录名
set websvc = getobject("iis://" & scomputer & "/w3svc/1") '//获得你当前站点对象。若有多个站点,那么改动后面1为2,3...即可指向其它的
set vroot = websvc.getobject("iiswebvirtualdir", "root") '//获得当前站点虚拟root
set classdefinition = getobject(vroot.schema)  '//获得虚拟目录的类定义
asmusthaves = classdefinition.mandatoryproperties
asmayhaves = classdefinition.optionalproperties
i=1
%>
<table border=1>
<tr><th>class must have property</th>
<th>root virtual directory current value</th></tr>
<%
on error resume next

for each thing in asmusthaves
response.write "<tr><td>("& cstr(i) & ") " &_
thing & "</td><td>" & vroot.get(thing) &_
"</td></tr>"
i = i + 1
next
%>
</table>


<table border=1>
<tr><th>class may have property</th>
<th>当前站点</th></tr>
<%
i=1
for each thing in asmayhaves
response.write "<tr><td>("& cstr(i) & ") " &_
thing & "</td><td>" & vroot.get(thing) &_
"</td></tr>"
i = i + 1
next
on error goto 0

'//建立虚拟目录
response.write svirdir & "
"
set vdir = vroot.create("iiswebvirtualdir",svirdir)

'//设置虚拟目录的两个属性,这里设置可读属性和将虚拟目录的路径指向物理路径
vdir.accessread = true
vdir.path = sphydir
vdir.setinfo '//将信息写入库,指的iis站点相关的库,不是你的用户数据表
%>

<%
rs.movenext
loop
rs.close
response.write "创建虚拟目录完成!"
%>

另外,还有利用adsi进行站点设置比如建站点,删除站点,配置站点ip,主机头,默认文档的等等,这里不做下载,有兴趣的朋友可以到微软站点下载 adsisdk 的开发文档深入。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons