<%
Call Response.AddHeader( "Content-Type", "text/html; Charset=shift_jis" )
Response.ExpiresAbsolute=#May 31,2000 23:59:59#
' **********************************************************' MODEL' **********************************************************
function UpdateMetaProp()
if IsEmpty( IIsWebVDir ) then
Exit Function
end if
' ディレクトリの参照
if Request.Form( "EnableDirBrowsing" ) = 1 then
' ( プロパティを利用してセット )
IIsWebVDir.EnableDirBrowsing = True
else
IIsWebVDir.EnableDirBrowsing = False
end if
' 書き込み
strProp = "AccessWrite"
if Request.Form( strProp ) = 1 then
' ( メソッドを利用してセット )
IIsWebVDir.Put strProp, True
else
IIsWebVDir.Put strProp, False
end if
IIsWebVDir.SetInfo
end function
' **********************************************************' CONTROL' **********************************************************
if Request.Form( "VDIR" ) <> "" then
strVDir = "IIS://localhost/W3SVC/1/Root/" & Request.Form( "VDIR" )
on error resume next
Set IIsWebVDir = GetObject(strVDir)
if Err.Number <> 0 then
strMessage = "指定した仮想ディレクトリは存在しません"
Set IIsWebVDir = Nothing
IIsWebVDir = Empty
end if
on error goto 0
end if
if Request.Form( "send" ) = "更新" then
Call UpdateMetaProp()
end if
%>
<!-- **********************************************************
VIEW
*********************************************************** -->
<FORM method=POST>
仮想ディレクトリ名 <INPUT type=text name=VDIR value="<%= Request.Form( "VDIR" ) %>">
<INPUT type=submit name=send value="表示">
<INPUT type=submit name=send value="更新">
<HR>
<%= strMessage %>
<% if not IsEmpty( IIsWebVDir ) then %>
<PRE>
<%= IIsWebVDir.Path %>
ディレクトリの参照 <INPUT type=checkbox name=EnableDirBrowsing value=1
<% if IIsWebVDir.EnableDirBrowsing then Response.Write "checked" end if %>>
書き込み <INPUT type=checkbox name=AccessWrite value=1
<% if IIsWebVDir.AccessWrite then Response.Write "checked" end if %>>
</PRE>
<% end if %>
</FORM>
開発用仮想ディレクトリ作成
/IISMyAdmin/CreateVDir.asp
<%
Call Response.AddHeader( "Content-Type", "text/html; Charset=shift_jis" )
Response.ExpiresAbsolute=#May 31,2000 23:59:59#
Dim strMessage
' **********************************************************' MODEL' **********************************************************
function CreateVDir()
if Trim( Request.Form("VDIR") ) = "" then
strMessage = "仮想ディレクトリを入力して下さい"
Exit Function
end if
BaseFolder = "C:\IISMyDirectory"
TargetFolder = BaseFolder & "\" & Request.Form("VDIR")
Set Fs = CreateObject("Scripting.FileSystemObject")
if Fs.FolderExists( TargetFolder ) Then
strMessage = TargetFolder & " は既に存在します"
Exit Function
end if
Call Fs.CreateFolder( TargetFolder )
strVDir = "IIS://localhost/W3SVC/1/Root/" & Request.Form("VDIR")
bExist = True
on error resume next
Set obj = GetObject(strVDir)
if Err.Number <> 0 then
Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
Set obj = IIsWebVDirRootObj.Create _
("IIsWebVirtualDir", Request.Form("VDIR") )
obj.Put "Path", TargetFolder
obj.SetInfo
bExist = False
end if
on error goto 0
if bExist then
strMessage = "仮想ディレクトリ " _
& Request.Form("VDIR") & " は既に存在します"
Exit Function
end if
obj.Put "AccessScript", True
obj.Put "AccessExecute", True
obj.Put "AccessSource", False
obj.Put "AccessRead", True
obj.Put "AccessWrite", True
obj.Put "EnableDirBrowsing", True
obj.Put "DontLog", False
obj.Put "ContentIndexed", False
obj.AppCreate2 2
obj.Put "AppFriendlyName", Request.Form("VDIR")
obj.Put "AspAllowSessionState", True
obj.Put "AspSessionTimeout", 20
obj.Put "AspBufferingOn", True
obj.Put "AspEnableParentPaths", True
obj.Put "AspScriptTimeout", 90
obj.Put "EnableDefaultDoc", True
obj.Put "DefaultDoc", "index.htm,index.html"
obj.Put "AspScriptFileCacheSize", False
obj.SetInfo
strMessage = "仮想ディレクトリ " _
& Request.Form("VDIR") & " を作成しました"
end function
' **********************************************************' CONTROL' **********************************************************
if Request.Form( "send" ) = "作成" then
Call CreateVDir()
end if
%>
<!-- **********************************************************
VIEW
*********************************************************** -->
<FORM method=POST>
仮想ディレクトリ名 <INPUT type=text name=VDIR value="<%= Request.Form( "VDIR" ) %>">
<INPUT type=submit name=send value="作成">
<HR>
<%= strMessage %>
</FORM>