Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

775 lines
25 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' Web_MasterSettings.asp: Change the web master settings
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 25-10-2000 Created date
  11. ' 15-01-2001 Modified for new Framework
  12. '-------------------------------------------------------------------------
  13. %>
  14. <!-- #include virtual="/admin/inc_framework.asp"--->
  15. <!-- #include virtual="/admin/wsa/inc_wsa.asp" -->
  16. <%
  17. '-------------------------------------------------------------------------
  18. ' Form Variables
  19. '-------------------------------------------------------------------------
  20. Dim F_bASPEnabled 'ASP enabled flag
  21. Dim F_strWebRootDir 'Root Dir for the form
  22. Dim F_strAspScriptTimeout 'Script timeout for the form
  23. Dim F_strIndexResource 'index resource for the form
  24. Dim F_strLimitedTo 'Limited connections
  25. Dim F_strMaxCon 'Max connections for the form
  26. '-------------------------------------------------------------------------
  27. ' Global Variables
  28. '-------------------------------------------------------------------------
  29. Dim G_objService 'to hold the connection
  30. Dim G_objSites
  31. '-------------------------------------------------------------------------
  32. ' Start of localization content
  33. '-------------------------------------------------------------------------
  34. Dim L_WEBTASKTITLETEXT
  35. Dim L_WEBROOTDIRTEXT
  36. Dim L_INVALID_DIR_FORMAT_ERRORMESSAGE
  37. Dim L_INVALID_DRIVE_ERRORMESSAGE
  38. Dim L_ASPSCRIPT_TIMEOUTTEXT
  39. Dim L_SECONDSTEXT
  40. Dim L_ENABLEFPSE_RESOURCETEXT
  41. Dim L_MAX_CONNECTIONSTEXT
  42. Dim L_UNLIMITEDTEXT
  43. Dim L_LIMITEDTOTEXT
  44. Dim L_CONLIMIT_ERRORMESSAGE
  45. Dim L_TIMEOUT_ERRORMESSAGE
  46. Dim L_FILEINFORMATION_ERRORMESSAGE
  47. Dim L_NOT_NTFS_DRIVE_ERRORMESSAGE
  48. Dim L_FAILED_CREATE_DIR_ERRORMESSAGE
  49. Dim L_INFORMATION_ERRORMESSAGE
  50. Dim L_UNABLETOSETMASTER_ERRORMESSAGE
  51. Dim L_UNABLETOSETROOTDIR_ERRORMESSAGE
  52. Dim L_DIR_ERRORMESSAGE
  53. Dim L_UNABLETOCREATE_KEY_ERRORMESSAGE
  54. Dim L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  55. Dim L_INVALID_DIR_ERRORMESSAGE
  56. Dim L_DIRPATHEMPTY_ERRORMESSAGE
  57. Dim L_ID_NOTEMPTY_ERROR_MESSAGE
  58. Dim L_SITE_IDENTIFIER_EMPTY_TEXT
  59. Dim L_ENABLE_ASP
  60. L_ENABLE_ASP = GetLocString("GeneralSettings.dll", "4042005C", "")
  61. L_WEBTASKTITLETEXT = GetLocString("GeneralSettings.dll", 40420001, "")
  62. L_WEBROOTDIRTEXT = GetLocString("GeneralSettings.dll", 40420002, "")
  63. L_INVALID_DIR_FORMAT_ERRORMESSAGE = GetLocString("GeneralSettings.dll", 40420004, "")
  64. L_INVALID_DRIVE_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420022", "")
  65. L_ASPSCRIPT_TIMEOUTTEXT = GetLocString("GeneralSettings.dll", 40420005, "")
  66. L_SECONDSTEXT = GetLocString("GeneralSettings.dll", 40420006, "")
  67. L_ENABLEFPSE_RESOURCETEXT = GetLocString("GeneralSettings.dll", 40420007, "")
  68. L_MAX_CONNECTIONSTEXT = GetLocString("GeneralSettings.dll", 40420008, "")
  69. L_UNLIMITEDTEXT = GetLocString("GeneralSettings.dll", 40420009, "")
  70. L_LIMITEDTOTEXT = GetLocString("GeneralSettings.dll", "4042000A", "")
  71. L_CONLIMIT_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000B", "")
  72. L_TIMEOUT_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420051", "")
  73. L_FILEINFORMATION_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000C", "")
  74. L_NOT_NTFS_DRIVE_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000D", "")
  75. L_FAILED_CREATE_DIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000E", "")
  76. L_INFORMATION_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000F", "")
  77. L_UNABLETOSETMASTER_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420010", "")
  78. L_UNABLETOSETROOTDIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420011", "")
  79. L_DIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420012", "")
  80. L_UNABLETOCREATE_KEY_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420018", "")
  81. L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420019", "")
  82. L_INVALID_DIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042004B", "")
  83. L_DIRPATHEMPTY_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042004C", "")
  84. '-------------------------------------------------------------------------
  85. 'END of localization content
  86. '-------------------------------------------------------------------------
  87. 'Create property page
  88. Dim rc
  89. Dim page
  90. rc=SA_CreatePage(L_WEBTASKTITLETEXT,"",PT_PROPERTY,page)
  91. 'Serve the page
  92. If(rc=0) then
  93. SA_ShowPage(Page)
  94. End if
  95. '-------------------------------------------------------------------------
  96. 'Function: OnInitPage()
  97. 'Description: Called to signal first time processing for this page.
  98. ' Use this method to do first time initialization tasks
  99. 'Input Variables: PageIn,EventArg
  100. 'Output Variables: None
  101. 'Returns: True/False
  102. 'Global Variables: None
  103. '-------------------------------------------------------------------------
  104. Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  105. InitObjects()
  106. SetVariablesFromSystem()
  107. OnInitPage = True
  108. End Function
  109. '-------------------------------------------------------------------------
  110. 'Function: OnServePropertyPage()
  111. 'Description: Called when the page needs to be served.Use this
  112. ' method to serve content
  113. 'Input Variables: PageIn,EventArg
  114. 'Output Variables: None
  115. 'Returns: True/False
  116. 'Global Variables: None
  117. '-------------------------------------------------------------------------
  118. Public Function OnServePropertyPage(ByRef PageIn,Byref EventArg)
  119. Call ServeCommonJavaScript()
  120. Call ServePage()
  121. OnServePropertyPage = True
  122. End Function
  123. '-------------------------------------------------------------------------
  124. 'Function: OnPostBackPage()
  125. 'Description: Called to signal that the page has been posted-back.
  126. 'Input Variables: PageIn,EventArg
  127. 'Output Variables: None
  128. 'Returns: True/False
  129. 'Global Variables: None
  130. '-------------------------------------------------------------------------
  131. Public Function OnPostBackPage(ByRef PageIn ,ByRef EventArg)
  132. OnPostBackPage = True
  133. End Function
  134. '-------------------------------------------------------------------------
  135. 'Function: OnSubmitPage()
  136. 'Description: Called when the page has been submitted for processing.
  137. ' Use this method to process the submit request.
  138. 'Input Variables: PageIn,EventArg
  139. 'Output Variables: None
  140. 'Returns: True/False
  141. 'Global Variables: None
  142. '-------------------------------------------------------------------------
  143. Public Function OnSubmitPage(ByRef PageIn ,ByRef EventArg)
  144. OnSubmitPage = ServeVariablesFromForm()
  145. End Function
  146. '-------------------------------------------------------------------------
  147. 'Function: OnClosePage()
  148. 'Description: Called when the page is about closed.Use this method
  149. ' to perform clean-up processing
  150. 'Input Variables: PageIn,EventArg
  151. 'Output Variables: None
  152. 'Returns: True/False
  153. 'Global Variables: None
  154. '-------------------------------------------------------------------------
  155. Public Function OnClosePage(ByRef PageIn ,ByRef EventArg)
  156. OnClosePage = TRUE
  157. End Function
  158. '-------------------------------------------------------------------------
  159. 'Function: ServeCommonJavaScript
  160. 'Description: Serves in initialiging the values,setting the form
  161. ' data and validating the form values
  162. 'Input Variables: None
  163. 'Output Variables: None
  164. 'Returns: True/False
  165. 'Global Variables: None
  166. '-------------------------------------------------------------------------
  167. Function ServeCommonJavaScript()
  168. %>
  169. <!-- #include virtual="/admin/wsa/inc_wsa.js" -->
  170. <!-- #include file="inc_MasterWeb.js" -->
  171. <script language="JavaScript" >
  172. //Validates connection limit
  173. function ValidatePage()
  174. {
  175. // validate functions
  176. var temp = document.frmTask.optMaxCon[1].checked;
  177. var temp1 = document.frmTask.txtLimitedTo.value;
  178. if(temp==true && temp1=="" )
  179. {
  180. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONLIMIT_ERRORMESSAGE))%>");
  181. document.frmTask.txtLimitedTo.focus();
  182. return false;
  183. }
  184. var strTimeOut = document.frmTask.txtAspScriptTimeout.value;
  185. if(strTimeOut=="" || strTimeOut==0 )
  186. {
  187. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_TIMEOUT_ERRORMESSAGE))%>");
  188. document.frmTask.txtAspScriptTimeout.focus();
  189. return false;
  190. }
  191. var strDirField = document.frmTask.txtWebRootDir.value;
  192. if(strDirField == "")
  193. {
  194. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_DIR_ERRORMESSAGE))%>");
  195. return false;
  196. }
  197. else
  198. {
  199. var nRetVal = strDirField.indexOf(":\\");
  200. var nRetVal1 = strDirField.indexOf("//");
  201. var nRetVal2 = strDirField.indexOf("\\\\");
  202. if (nRetVal== -1 || nRetVal1 > 0 || nRetVal2 > 0)
  203. {
  204. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_FORMAT_ERRORMESSAGE))%>");
  205. return false;
  206. }
  207. }
  208. var strID = "";
  209. strID = document.frmTask.txtWebRootDir.value;
  210. var strIndex = strID.indexOf("\\\\");
  211. if (strIndex > 0)
  212. {
  213. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_FORMAT_ERRORMESSAGE))%>");
  214. document.frmTask.txtWebRootDir.focus();
  215. return false;
  216. }
  217. // validate site directory
  218. if (!(checkKeyforValidCharacters(strID)))
  219. return false;
  220. var strMaxCon = document.frmTask.txtLimitedTo.value;
  221. var ChktxtLimitedTo = document.frmTask.optMaxCon[1].checked;
  222. if(ChktxtLimitedTo == true)
  223. {
  224. if (strMaxCon == 0 || strMaxCon == "" )
  225. {
  226. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONLIMIT_ERRORMESSAGE))%>");
  227. document.frmTask.txtLimitedTo.focus();
  228. return false;
  229. }
  230. }
  231. UpdateHiddenVariables();
  232. return true;
  233. return true;
  234. }
  235. function checkKeyforValidCharacters(strID)
  236. {
  237. var len = strID.length;
  238. var charAtPos;
  239. if(len > 0)
  240. {
  241. for(var i=0; i<len;i++)
  242. {
  243. charAtPos = strID.charCodeAt(i);
  244. if(charAtPos ==47 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44)
  245. {
  246. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_ERRORMESSAGE))%>");
  247. document.frmTask.txtWebRootDir.value = strID;
  248. document.frmTask.txtWebRootDir.focus();
  249. return false;
  250. }
  251. }
  252. return true;
  253. }
  254. else
  255. {
  256. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_DIRPATHEMPTY_ERRORMESSAGE))%>");
  257. document.frmTask.txtWebRootDir.focus();
  258. return false;
  259. }
  260. }
  261. //init function
  262. function Init()
  263. {
  264. }
  265. function UpdateHiddenVariables()
  266. {
  267. //document.frmTask.hdnASPEnabled.value = document.frmTask.chkASPEnabled.checked;
  268. document.frmTask.hdnWebRootDir.value = document.frmTask.txtWebRootDir.value;
  269. document.frmTask.hdnIndex.value = document.frmTask.chkIndexResource.checked;
  270. }
  271. //sets the data
  272. function SetData()
  273. {
  274. UpdateHiddenVariables();
  275. }
  276. function checkforEmptyfield()
  277. {
  278. var strScriptTimeOut = document.frmTask.txtAspScriptTimeout.value;
  279. if (strScriptTimeOut == "" || strScriptTimeOut == 0)
  280. document.frmTask.txtAspScriptTimeout.value = 1;
  281. var strMaxCon = document.frmTask.txtLimitedTo.value;
  282. var ChktxtLimitedTo = document.frmTask.optMaxCon[1].checked;
  283. if(ChktxtLimitedTo == true)
  284. {
  285. //if (strMaxCon == "" || strMaxCon == 0)
  286. if (strMaxCon == "" || strMaxCon < 2)
  287. document.frmTask.txtLimitedTo.value = 2;
  288. }
  289. }
  290. // Enable ASP clicked
  291. //function EnableASP()
  292. //{
  293. // EnableOK();
  294. // if ( document.frmTask.chkASPEnabled.checked == false )
  295. // {
  296. // document.frmTask.txtAspScriptTimeout.disabled = true;
  297. // }
  298. // else
  299. // {
  300. // document.frmTask.txtAspScriptTimeout.disabled = false;
  301. // }
  302. // }
  303. </script>
  304. <% End Function
  305. '-------------------------------------------------------------------------
  306. 'Function: ServePage()
  307. 'Description: For displaying outputs HTML to the user
  308. 'Input Variables: None
  309. 'Output Variables: None
  310. 'Returns: None
  311. 'Global Variables: L_DELETE_CONFIRM_TEXT
  312. '-------------------------------------------------------------------------
  313. Function ServePage
  314. %>
  315. <TABLE WIDTH=600 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0
  316. CELLPADDING=2 class="TasksBody">
  317. <TR>
  318. <TD>
  319. &nbsp;
  320. </TD>
  321. <TD>
  322. &nbsp;
  323. </TD>
  324. </TR>
  325. <TR>
  326. <TD>
  327. <%=L_WEBROOTDIRTEXT %>
  328. </TD>
  329. <TD>
  330. &nbsp;<INPUT TYPE=TEXT NAME=txtWebRootDir class="formField" tabIndex=1 VALUE="<%=F_strWebRootDir%>" SIZE=30 TABINDEX=1 onKeyPress = "ClearErr()">
  331. </TD>
  332. </TR>
  333. <TR>
  334. <TD>
  335. &nbsp;
  336. </TD>
  337. <TD>
  338. &nbsp;
  339. </TD>
  340. </TR>
  341. <TR>
  342. <TD>
  343. <%=L_ASPSCRIPT_TIMEOUTTEXT%>
  344. </TD>
  345. <TD>
  346. &nbsp;<INPUT TYPE=TEXT NAME=txtAspScriptTimeout class="formField" tabIndex=6 VALUE="<%=Server.HTMLEncode(F_strAspScriptTimeout)%>" SIZE=30 TABINDEX=2 OnKeyUP="javaScript:checkUserLimit(this,'scripttimeout');" OnKeypress="javaScript:checkKeyforNumbers(this);" onblur = "checkforEmptyfield();">
  347. </TD>
  348. </TR>
  349. <TR>
  350. <TD>
  351. &nbsp;
  352. </TD>
  353. <TD>
  354. &nbsp;
  355. </TD>
  356. </TR>
  357. <TR>
  358. <TD>
  359. <% if F_strIndexResource = true then%>
  360. <INPUT TYPE=checkbox NAME=chkIndexResource class="formField" checked tabIndex=7 VALUE="<%=F_strIndexResource%>" >
  361. <% else %>
  362. <INPUT TYPE=checkbox NAME=chkIndexResource class="formField" tabIndex=7 VALUE="<%=F_strIndexResource%>" >
  363. <% end if %>
  364. &nbsp;&nbsp;&nbsp;<%=L_ENABLEFPSE_RESOURCETEXT%>
  365. </TD>
  366. </TR>
  367. <TR>
  368. <TD>
  369. &nbsp;
  370. </TD>
  371. <TD>
  372. &nbsp;
  373. </TD>
  374. </TR>
  375. <TR>
  376. <TD>
  377. <%=L_MAX_CONNECTIONSTEXT%>
  378. </TD>
  379. <TD>
  380. <% if F_strMaxCon = L_UNLIMITEDTEXT then %>
  381. <INPUT TYPE=radio NAME=optMaxCon onclick = "txtLimitedTo.disabled = true; txtLimitedTo.value = '';" tabIndex=8 checked class="formField" VALUE="<%=L_UNLIMITEDTEXT%>" ><%=L_UNLIMITEDTEXT%>
  382. <%else%>
  383. <INPUT TYPE=radio NAME=optMaxCon onclick = "txtLimitedTo.disabled = true; txtLimitedTo.value = '';" tabIndex=8 class="formField" VALUE="<%=L_UNLIMITEDTEXT%>" ><%=L_UNLIMITEDTEXT%>
  384. <%end if%>
  385. </TD>
  386. </TR>
  387. <TR>
  388. <TD>
  389. </TD>
  390. <TD>
  391. <% if F_strMaxCon = L_LIMITEDTOTEXT then %>
  392. <INPUT TYPE=radio NAME=optMaxCon checked class="formField" VALUE="<%=L_LIMITEDTOTEXT%>" tabIndex=9 onclick = "txtLimitedTo.disabled = false; txtLimitedTo.focus();"><%=L_LIMITEDTOTEXT%>
  393. &nbsp;&nbsp;<INPUT TYPE=TEXT NAME=txtLimitedTo class="formField" tabIndex=10 VALUE="<%=F_strLimitedTo%>" SIZE=30 OnKeyUP="javaScript:checkUserLimit(this,'con');" onblur = "checkforEmptyfield();" OnKeypress="javaScript:checkKeyforNumbers(this);">
  394. <%else%>
  395. <INPUT TYPE=radio NAME=optMaxCon class="formField" VALUE="<%=L_LIMITEDTOTEXT%>" tabIndex=9 onclick = "txtLimitedTo.disabled = false;txtLimitedTo.focus();"><%=L_LIMITEDTOTEXT%>
  396. &nbsp;&nbsp;<INPUT TYPE=TEXT NAME=txtLimitedTo disabled class="formField" onblur = "checkforEmptyfield();" tabIndex=10 VALUE="<%=F_strLimitedTo%>" SIZE=30 OnKeyUP="javaScript:checkUserLimit(this,'con');" OnKeypress="javaScript:checkKeyforNumbers(this);">
  397. <%end if%>
  398. </TD>
  399. </TR>
  400. </TABLE>
  401. <input type=hidden name="hdnWebRootDir" value="<%=F_strWebRootDir%>">
  402. <input type=hidden name="hdnIndex" >
  403. <input type=hidden name="hdnASPEnabled" >
  404. <%
  405. End Function
  406. '-------------------------------------------------------------------------
  407. 'Function name: ServeVariablesFromForm()
  408. 'Description: Serves in getting the data from Client
  409. 'Input Variables: None
  410. 'Output Variables: None
  411. 'Returns: True/False
  412. 'Global Variables: None
  413. '-------------------------------------------------------------------------
  414. Function ServeVariablesFromForm
  415. 'setting the form variables
  416. F_strWebRootDir = Request.Form("txtWebRootDir")
  417. F_strAspScriptTimeout = Request.Form("txtAspScriptTimeout")
  418. F_strIndexResource = Request.Form("hdnIndex")
  419. F_strMaxCon = Request.Form("optMaxCon")
  420. F_strLimitedTo = Request.Form("txtLimitedTo")
  421. F_bASPEnabled = Request.Form("hdnASPEnabled")
  422. 'set the master settings
  423. If ConfigWebServer()then
  424. ServeVariablesFromForm = true
  425. else
  426. ServeVariablesFromForm = false
  427. end if
  428. End Function
  429. '-------------------------------------------------------------------------
  430. 'Function name: InitObjects
  431. 'Description: Initialization of global variables is done
  432. 'Input Variables: None
  433. 'Returns: true/false
  434. '--------------------------------------------------------------------------
  435. Function InitObjects()
  436. on error resume next
  437. ' Get instances of IIS_WebServiceSetting that are visible throughout
  438. Set G_objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  439. Set G_objSites = G_objService.InstancesOf(GetIISWMIProviderClassName("IIS_WebServiceSetting"))
  440. if Err.number <> 0 or G_objSites.count = 0 then
  441. SetErrMsg L_INFORMATION_ERRORMESSAGE
  442. Call SA_TraceOut("WEB_MASTERSETTINGS", "InitObjects() encountered error: "+ CStr(Hex(Err.Number)))
  443. end if
  444. End Function
  445. '-------------------------------------------------------------------------
  446. 'Function name: ConfigWebServer
  447. 'Description: sets the web site root dir and also sets index resource,
  448. ' connection limit and other properties.
  449. 'Input Variables: None
  450. 'Returns: true/false
  451. 'Global variables: None
  452. 'Other functions used: SetWebSiteRootVal
  453. '-------------------------------------------------------------------------
  454. Function ConfigWebServer()
  455. on error resume next
  456. err.clear
  457. ConfigWebServer = false
  458. if ValidateInputs = FALSE then
  459. SA_TraceOut "web_mastersettings", "Validate inputs failed"
  460. exit function
  461. end if
  462. if NOT SetWebSiteRootVal(F_strWebRootDir) then
  463. SetErrMsg L_UNABLETOSETROOTDIR_ERRORMESSAGE
  464. SA_TraceOut "web_mastersettings", "Unable to set the root directory value to the registry "
  465. exit function
  466. end if
  467. if NOT SetWebMasterSettings() then
  468. SetErrMsg L_UNABLETOSETMASTER_ERRORMESSAGE
  469. SA_TraceOut "web_mastersettings", "Unable to set the Web master settings"
  470. exit function
  471. end if
  472. ConfigWebServer = true
  473. 'Release the object
  474. set G_objSites = nothing
  475. set G_objService = nothing
  476. end function
  477. '-------------------------------------------------------------------------
  478. 'Function name: ValidateInputs
  479. 'Description: Check whether directory exists
  480. ' If directory does not exist, create the web site if the drive letter is valid
  481. ' else give error message
  482. 'Input Variables: None
  483. 'Returns: true/false
  484. 'Global variables: None
  485. '-------------------------------------------------------------------------
  486. Function ValidateInputs
  487. on error resume next
  488. err.clear
  489. Dim objFso
  490. Dim nRetVal
  491. ValidateInputs = FALSE
  492. Set objFso = server.CreateObject("Scripting.FileSystemObject")
  493. if Err.number <> 0 then
  494. SetErrMsg L_FILEINFORMATION_ERRORMESSAGE
  495. exit function
  496. end if
  497. nRetVal = CreateSitePath( objFso, F_strWebRootDir )
  498. if nRetVal <> CONST_SUCCESS then
  499. if nRetVal = CONST_INVALID_DRIVE then
  500. SetErrMsg L_INVALID_DRIVE_ERRORMESSAGE
  501. elseif nRetVal = CONST_NOTNTFS_DRIVE then
  502. SetErrMsg L_NOT_NTFS_DRIVE_ERRORMESSAGE
  503. else
  504. SetErrMsg L_FAILED_CREATE_DIR_ERRORMESSAGE
  505. end if
  506. exit Function
  507. end if
  508. 'release the object
  509. set objFso = nothing
  510. ValidateInputs = TRUE
  511. End Function
  512. '-------------------------------------------------------------------------
  513. 'Function name: SetWebMasterSettings
  514. 'Description: sets the Master settings to the Master Web
  515. 'Input Variables: None
  516. 'Returns: true/false
  517. 'Global variables: None
  518. '-------------------------------------------------------------------------
  519. Function SetWebMasterSettings()
  520. on error resume next
  521. err.clear
  522. Dim inst
  523. Dim objService
  524. Dim objSites
  525. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  526. Set objSites = objService.InstancesOf(GetIISWMIProviderClassName("IIS_WebServiceSetting"))
  527. if Err.number <> 0 or objSites.count = 0 then
  528. SetErrMsg L_INFORMATION_ERRORMESSAGE
  529. Call SA_TraceOut("WEB_MASTERSETTINGS", "InitObjects() encountered error: "+ CStr(Hex(Err.Number)))
  530. end if
  531. SetWebMasterSettings = false
  532. for each inst in objSites
  533. inst.AspScriptTimeout = clng(F_strAspScriptTimeout)
  534. call SetFPSEOption(F_strIndexResource)
  535. 'to set maximum connections
  536. select case F_strMaxCon
  537. case L_UNLIMITEDTEXT
  538. 'In IIS 6.0, -1 indicates unlimited connections
  539. if IsIIS60Installed() Then
  540. inst.Maxconnections = -1
  541. Else
  542. inst.Maxconnections = 2000000000
  543. End If
  544. case else
  545. inst.Maxconnections = clng(F_strLimitedTo)
  546. end select
  547. inst.put_(WBEMFLAG)
  548. if Err.number <> 0 then
  549. SetErrMsg L_UNABLETOSETMASTER_ERRORMESSAGE
  550. SA_TraceOut "web_mastersettings", "Unable to set the Web master settings"
  551. exit function
  552. end if
  553. SetWebMasterSettings = true
  554. exit for
  555. Next
  556. SetWebMasterSettings = true
  557. 'Release the objects
  558. set objService = nothing
  559. set objSites = nothing
  560. End Function
  561. '-------------------------------------------------------------------------
  562. 'Function name: SetWebSiteRootVal
  563. 'Description: sets the web site root dir
  564. 'Input Variables: strWebRootDir
  565. 'Returns: true/false
  566. 'Global variables: None
  567. '--------------------------------------------------------------------------
  568. Function SetWebSiteRootVal(strWebRootDir)
  569. on error resume next
  570. Err.clear
  571. Dim IRC
  572. Dim objGetHandle
  573. Dim rtnCreateKey
  574. SetWebSiteRootVal = FALSE
  575. set objGetHandle = RegConnection()
  576. rtnCreateKey = RegCreateKey(objGetHandle,CONST_WEBBLADES_REGKEY)
  577. IRC = objGetHandle.SetStringValue(G_HKEY_LOCAL_MACHINE,CONST_WEBBLADES_REGKEY,CONST_WEBSITEROOT_REGVAL,strWebRootDir)
  578. If Err.number <> 0 then
  579. SA_TraceOut "FTP_Master Settings", L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  580. SetErrMsg L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  581. exit function
  582. end if
  583. SetWebSiteRootVal = TRUE
  584. 'Release the object
  585. set objGetHandle = nothing
  586. End Function
  587. '-------------------------------------------------------------------------
  588. 'Function name: SetVariablesFromSystem
  589. 'Description: Serves in Getting the data from Client
  590. 'Input Variables: None
  591. 'Output Variables: None
  592. 'Returns: None
  593. 'Global Variables: G_objSites
  594. '-------------------------------------------------------------------------
  595. Function SetVariablesFromSystem()
  596. Err.Clear
  597. on error resume next
  598. Dim nRetval
  599. Dim inst
  600. Dim rtnDriveInitialze
  601. Dim strDriveLetter
  602. 'Getting values from system
  603. nRetval = GetWebSiteRootVal(F_strWebRootDir)
  604. if nRetval <> CONST_SUCCESS then
  605. SA_TraceOut "web_mastersettings", "failed to get the web root dir val"
  606. if NOT GetDefWebRootVal(F_strWebRootDir) then
  607. SetErrMsg L_FAIL_TO_GET_WEBSITEROOT_DIR
  608. end if
  609. end if
  610. for each inst in G_objSites
  611. if inst.Name = "W3SVC" then
  612. select case inst.Logtype
  613. case 1
  614. F_strLogDeny = "true"
  615. case else
  616. F_strLogDeny = "false"
  617. end select
  618. end if
  619. next
  620. for each inst in G_objSites
  621. F_strAspScriptTimeout = inst.AspScriptTimeout
  622. F_strIndexResource = GetFPSEOption()
  623. select case inst.Maxconnections
  624. 'In IIS 6.0, -1 indicates unlimited connections
  625. case -1
  626. if IsIIS60Installed() Then
  627. F_strMaxCon = L_UNLIMITEDTEXT
  628. End If
  629. case 2000000000
  630. F_strMaxCon = L_UNLIMITEDTEXT
  631. case else
  632. F_strMaxCon = L_LIMITEDTOTEXT
  633. F_strLimitedTo = inst.Maxconnections
  634. end select
  635. Next
  636. End Function
  637. %>