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.

667 lines
21 KiB

  1. <% @Language=VbScript%>
  2. <% Option Explicit%>
  3. <%
  4. '---------------------------------------------------------------------
  5. ' nicdns_prop.asp: display and update the DNS properties of NIC.
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 15-Jan-01 Creation Date.
  11. ' 06-Mar-01 Modified Date
  12. '---------------------------------------------------------------------
  13. %>
  14. <!-- #include virtual="/admin/inc_framework.asp"--->
  15. <!-- #include file="loc_nicspecific.asp" -->
  16. <!-- #include file="inc_network.asp" -->
  17. <%
  18. '---------------------------------------------------------------------
  19. 'Global Variables
  20. '---------------------------------------------------------------------
  21. Dim G_objService 'Instance of the WMI Connection
  22. Dim page 'Variable that receives the output page object when
  23. 'creating a page
  24. Dim rc 'Return value for CreatePage
  25. Dim SOURCE_FILE 'To get file name
  26. SOURCE_FILE = SA_GetScriptFileName()
  27. '---------------------------------------------------------------------
  28. 'Form Variables
  29. '---------------------------------------------------------------------
  30. Dim F_ID 'ID of the Network Adapter
  31. Dim F_radSelected 'Which option is selected
  32. ' "1" means DHCP enabled
  33. ' "2" means Manual Settings
  34. Dim F_DNSserverList '"," seperated DNS Server list
  35. Dim F_strFlag 'To hold the Flag Value
  36. 'to hold the registry path
  37. Const G_CONST_REGISTRY_PATH ="SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
  38. 'Create property page
  39. rc=SA_CreatePage(L_DNSTASKTITLE_TEXT,"",PT_PROPERTY,page)
  40. 'Serve the page
  41. If(rc=0) then
  42. SA_ShowPage(Page)
  43. End if
  44. '-------------------------------------------------------------------------
  45. 'Function: OnInitPage()
  46. 'Description: Called to signal first time processing for this page.
  47. ' Use this method to do first time initialization tasks
  48. 'Input Variables: PageIn,EventArg
  49. 'Output Variables: PageIn,EventArg
  50. 'Returns: True/False
  51. 'Global Variables: None
  52. '-------------------------------------------------------------------------
  53. Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  54. Call SA_TraceOut( SOURCE_FILE, "OnInitPage")
  55. 'getting default values of dns server settings
  56. OnInitPage = SetDnsDefaultValues()
  57. End Function
  58. '-------------------------------------------------------------------------
  59. 'Function: OnServePropertyPage()
  60. 'Description: Called when the page needs to be served.Use this
  61. ' method to serve content
  62. 'Input Variables: PageIn,EventArg
  63. 'Output Variables: PageIn,EventArg
  64. 'Returns: True/False
  65. 'Global Variables: In:G_objService-Getting WMI connection Object
  66. ' In:F_iD-Getting NIC adapter Index
  67. ' In:F_radSelected-Getting radio button selection
  68. ' In:F_DNSserverList-Getting new list dns servers
  69. ' In:L_(*)-Localization content
  70. '-------------------------------------------------------------------------
  71. Public Function OnServePropertyPage(ByRef PageIn,Byref EventArg)
  72. Dim objNetAdapter
  73. Dim strDHCPEnabled
  74. Call SA_TraceOut( SOURCE_FILE, "OnServerPropertyPage")
  75. ' To get the Network Adapter object
  76. set objNetAdapter = getNetworkAdapterObject(G_objService,F_iD)
  77. 'Get Whether the DHCP is enabled on the NIC.
  78. strDHCPEnabled = isDHCPenabled(objNetAdapter)
  79. Call ServeCommonJavaScript()
  80. %>
  81. <table width=518 valign=middle align=left border=0 cellspacing=0 cellpadding=2>
  82. <tr>
  83. <td class='TasksBody' nowrap colspan=4><B><%=GetNicName(F_ID)%></B></td>
  84. </tr>
  85. <tr>
  86. <td class='TasksBody' colspan=4>&nbsp;</td>
  87. </tr>
  88. <tr>
  89. <td nowrap width=130px class='TasksBody'>
  90. <%=L_CONFIGURATION_TEXT%>
  91. </td>
  92. <td colspan="3" class='TasksBody'>
  93. <input type="RADIO" class="FormRadioButton" name="radIP" tabIndex=0 value="IPDEFAULT"
  94. <% 'if DHCP is disabled then disable
  95. 'this radio button
  96. If Not strDHCPEnabled Then
  97. response.write " Disabled "
  98. Else
  99. response.write " Checked "
  100. End If
  101. %>
  102. onClick="EnableOK();disableDNSControls(true);" >
  103. <%= L_OBTAINIPFROMDHCP_TEXT%>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td class='TasksBody'>&nbsp; </TD>
  108. <td nowrap colspan="3" class='TasksBody'>
  109. <input type="radio" class="FormRadioButton" NAME="radIP" tabIndex=1 value="IPMANUAL"
  110. <%
  111. 'if DHCP is disabled then disable this radio button
  112. If Ucase(F_strFlag)=Ucase("No") Then
  113. Response.Write ""
  114. else
  115. response.write " Checked "
  116. End If
  117. %>
  118. onClick="EnableOK(); enableDNSControls();" >
  119. <%=L_DNSCONFIGUREMANUALLY_TEXT%>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td align="RIGHT" colspan=4 class='TasksBody'>
  124. <%=L_DNS_SERVER_ADDRESSES_TEXT%>
  125. </td>
  126. </tr>
  127. <tr height="22">
  128. <td nowrap valign="top" class='TasksBody'>
  129. <%=L_LIST_DNSSERVERS_TEXT%>
  130. </td>
  131. <td valign="top" class='TasksBody'>
  132. <select name="cboDNSServers" class="FormField" SIZE=6 tabIndex=2 STYLE="WIDTH: 225px" >
  133. <%OutputDNServersToListbox()%>
  134. </select>
  135. </td>
  136. <td nowrap align=center valign="top" width="110" class='TasksBody'>
  137. <%
  138. Call SA_ServeOnClickButtonEx(L_BUTTON_ADD_TEXT, "", "addDNSServerToListBox()", 60, 0, "DISABLED", "btnAddDNS")
  139. %>
  140. <br><br><br><br><br>
  141. <%
  142. Call SA_ServeOnClickButtonEx(L_BUTTON_REMOVE_TEXT, "", "EnableOK();removeListBoxItems(document.frmTask.cboDNSServers,document.frmTask.btnRemoveDNS);EnableAddText()", 60, 0, "DISABLED", "btnRemoveDNS")
  143. %>
  144. </td>
  145. <td valign="top" class='TasksBody'>
  146. <input class='FormField' type="text" name="txtDNS" value="" size=20 maxlength=15 onKeyPress="checkKeyforIPAddress(txtDNS)" onkeyup="disableAddButton(this,document.frmTask.btnAddDNS)" tabIndex=3 onmouseup="disableAddButton(this,document.frmTask.btnAddDNS)">
  147. </td>
  148. </tr>
  149. </table>
  150. <input type="hidden" name="hdnNicID" value="<%= F_ID %>">
  151. <input type="HIDDEN" name="hdnDNSserverList" value="<%=F_DNSserverList%>">
  152. <input type="HIDDEN" name="hdnRadioSelected" value="<%=F_radSelected%>">
  153. <%
  154. 'destroying dynamically created objects
  155. Set objNetAdapter=Nothing
  156. OnServePropertyPage = True
  157. End Function
  158. '-------------------------------------------------------------------------
  159. 'Function: OnPostBackPage()
  160. 'Description: Called to signal that the page has been posted-back.
  161. 'Input Variables: PageIn,EventArg
  162. 'Output Variables: PageIn,EventArg
  163. 'Returns: True/False
  164. 'Global Variables: None
  165. '-------------------------------------------------------------------------
  166. Public Function OnPostBackPage(ByRef PageIn ,ByRef EventArg)
  167. Call SA_TraceOut( SOURCE_FILE, "OnPostBackPage")
  168. OnPostBackPage = True
  169. End Function
  170. '-------------------------------------------------------------------------
  171. 'Function: OnSubmitPage()
  172. 'Description: Called when the page has been submitted for processing.
  173. ' Use this method to process the submit request.
  174. 'Input Variables: PageIn,EventArg
  175. 'Output Variables: PageIn,EventArg
  176. 'Returns: True/False
  177. 'Global Variables: In: G_objService-Getting WMI connection Object
  178. ' Out:F_iD-Getting NIC adapter Index
  179. ' Out:F_radSelected-Getting radio button selection
  180. ' Out:F_DNSserverList-Getting new list dns servers
  181. ' In: L_(*)-Localization content
  182. '-------------------------------------------------------------------------
  183. Public Function OnSubmitPage(ByRef PageIn ,ByRef EventArg)
  184. Call SA_TraceOut( SOURCE_FILE, "OnSubmitPage")
  185. 'Nic adapter index no
  186. F_ID = Request.Form("hdnNicID")
  187. 'Dns servers list after form has been submiited
  188. F_DNSserverList = Request.Form("hdnDNSserverList")
  189. ' The radio button to be selected - contains 1 or 2 only
  190. F_radSelected = Request.Form("hdnRadioSelected")
  191. 'Getting WMI connection Object on error displays failure page
  192. Set G_objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  193. 'Updating the dsn server settings
  194. If UpdateDNSSettingsForNIC() Then
  195. OnSubmitPage = true
  196. Else
  197. OnSubmitPage = false
  198. End If
  199. End Function
  200. '-------------------------------------------------------------------------
  201. 'Function: OnClosePage()
  202. 'Description: Called when the page is about closed.Use this method
  203. ' to perform clean-up processing
  204. 'Input Variables: PageIn,EventArg
  205. 'Output Variables: PageIn,EventArg
  206. 'Returns: True/False
  207. 'Global Variables: None
  208. '-------------------------------------------------------------------------
  209. Public Function OnClosePage(ByRef PageIn ,ByRef EventArg)
  210. Call SA_TraceOut( SOURCE_FILE, "OnClosePage")
  211. Set G_objService = nothing
  212. OnClosePage = TRUE
  213. End Function
  214. '-------------------------------------------------------------------------
  215. 'Function: ServeCommonJavaScript
  216. 'Description: Serves in initializing the values,setting the form
  217. ' data and validating the form values
  218. 'Input Variables: None
  219. 'Output Variables: None
  220. 'Returns: True/False
  221. 'Global Variables: None
  222. '-------------------------------------------------------------------------
  223. Function ServeCommonJavaScript()
  224. Err.Clear
  225. On Error Resume Next
  226. Call SA_TraceOut( SOURCE_FILE, "ServeCommonJavaScript")
  227. %>
  228. <script language="JavaScript" src ="<%=m_VirtualRoot%>inc_global.js">
  229. </script>
  230. <script language="JavaScript">
  231. //global value to hold the frmTask Object
  232. var FrmObj
  233. //
  234. // Microsoft Server Appliance Web Framework Support Functions
  235. // Copyright (c) Microsoft Corporation. All rights reserved.
  236. //
  237. // Init Function
  238. // -----------
  239. // This function is called by the Web Framework to allow the page
  240. // to perform first time initialization.
  241. //
  242. // This function must be included or a javascript runtime error will occur.
  243. //
  244. function Init()
  245. {
  246. FrmObj = eval(document.frmTask)
  247. //Disable the DNS server address text box if dns server listbox already contains 20 items
  248. if(FrmObj.cboDNSServers.length>=20)
  249. {document.frmTask.txtDNS.disabled = true}
  250. else
  251. {document.frmTask.txtDNS.disabled = false}
  252. if(FrmObj.radIP[1].checked && FrmObj.cboDNSServers.length >0 )
  253. FrmObj.cboDNSServers.options[0].selected = true;
  254. if(FrmObj.radIP[0].checked)
  255. disableDNSControls(true);
  256. else if(FrmObj.cboDNSServers.length< 20)
  257. {
  258. enableDNSControls();
  259. }
  260. //Checking for 0 length list if so make
  261. if (FrmObj.cboDNSServers.length==0)
  262. {
  263. FrmObj.btnRemoveDNS.disabled=true;
  264. }
  265. //function call to disable add button of DNS
  266. disableAddButton(FrmObj.txtDNS,FrmObj.btnAddDNS)
  267. }
  268. // end of function Init()
  269. // ValidatePage Function
  270. // ------------------
  271. // This function is called by the Web Framework as part of the
  272. // submit processing. Use this function to validate user input. Returning
  273. // false will cause the submit to abort.
  274. //
  275. // This function must be included or a javascript runtime error will occur.
  276. //
  277. // Returns: True if the page is OK, false if error(s) exist.
  278. function ValidatePage()
  279. {
  280. return true;
  281. }
  282. // SetData Function
  283. // --------------
  284. // This function is called by the Web Framework and is called
  285. // only if ValidatePage returned a success (true) code. Typically you would
  286. // modify hidden form fields at this point.
  287. //
  288. // This function must be included or a javascript runtime error will occur.
  289. //
  290. // function to set the hidden field with the selected DNS server
  291. // list values
  292. function SetData()
  293. {
  294. var nIndex
  295. var strDNSServer
  296. strDNSServer =""
  297. for(nIndex= 0; nIndex < FrmObj.cboDNSServers.length; nIndex++)
  298. {
  299. if(nIndex==20)
  300. {
  301. break;
  302. }
  303. strDNSServer = strDNSServer +
  304. FrmObj.cboDNSServers.options[nIndex].value + ",";
  305. }
  306. FrmObj.hdnDNSserverList.value = strDNSServer
  307. if(FrmObj.radIP[0].checked)
  308. FrmObj.hdnRadioSelected.value = "1"
  309. else
  310. FrmObj.hdnRadioSelected.value = "2"
  311. }
  312. // Depending on the flag the controls lisbox, textbox, Add &
  313. // remove buttons are disabled or enabled
  314. function disableDNSControls(strFlag)
  315. {
  316. if ( strFlag )
  317. {
  318. FrmObj.btnRemoveDNS.disabled = true;
  319. FrmObj.btnAddDNS.disabled = true;
  320. FrmObj.txtDNS.disabled = true;
  321. if(FrmObj.cboDNSServers.length > 0)
  322. {
  323. FrmObj.cboDNSServers.selectedIndex = -1;
  324. }
  325. FrmObj.cboDNSServers.disabled = true;
  326. }
  327. else
  328. {
  329. FrmObj.btnRemoveDNS.disabled = false;
  330. FrmObj.btnAddDNS.disabled = false;
  331. }
  332. }
  333. function enableDNSControls()
  334. {
  335. FrmObj.txtDNS.disabled = false;
  336. FrmObj.txtDNS.value=""
  337. FrmObj.txtDNS.focus()
  338. FrmObj.cboDNSServers.disabled = false;
  339. // if any dns entries present, select the first
  340. // and enable the Remove button
  341. if(FrmObj.cboDNSServers.length > 0)
  342. {
  343. FrmObj.cboDNSServers.selectedIndex = 0;
  344. FrmObj.btnRemoveDNS.disabled = false;
  345. }
  346. }
  347. // Adds the value in the text box in to the listbox
  348. function addDNSServerToListBox()
  349. {
  350. var intErrorNumber
  351. intErrorNumber = isValidIP(FrmObj.txtDNS)
  352. if( intErrorNumber != 0)
  353. {
  354. assignErrorString(intErrorNumber)
  355. document.onkeypress=ClearErr;
  356. FrmObj.btnAddDNS.disabled = true;
  357. FrmObj.txtDNS.focus()
  358. return false;
  359. }
  360. else
  361. {
  362. if(!addToListBox(FrmObj.cboDNSServers,FrmObj.btnRemoveDNS,FrmObj.txtDNS.value,FrmObj.txtDNS.value))
  363. {
  364. SA_DisplayErr('<%=SA_EscapeQuotes(L_DUPLICATEDNS_ERRORMESSAGE)%>');
  365. document.onkeypress=ClearErr;
  366. return false;
  367. }
  368. else
  369. {
  370. FrmObj.txtDNS.value="";
  371. FrmObj.txtDNS.focus();
  372. }
  373. }
  374. EnableOK()
  375. //Enable the DNS server address text box if dns server listbox contains less than 20 items
  376. EnableAddText()
  377. }
  378. // Function to make the add button disable
  379. function disableAddButton(objText,objButton)
  380. {
  381. if(Trim(objText.value)=="")
  382. objButton.disabled=true;
  383. else
  384. objButton.disabled=false;
  385. }
  386. //Function to assign Error strings based on the Input number
  387. function assignErrorString(intErrorNumber)
  388. {
  389. switch( intErrorNumber)
  390. {
  391. case 1:
  392. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_ENTERVALIDIP_ERRORMESSAGE)%>');
  393. break;
  394. case 2:
  395. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_INVALIDIPFORMAT_ERRORMESSAGE)%>');
  396. break;
  397. case 4:
  398. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_IPSTART_ERRORMESSAGE)%>');
  399. break;
  400. case 5:
  401. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_IPLOOPBACK_ERRORMESSAGE)%>');
  402. break;
  403. case 6:
  404. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_IPBOUNDSEXCEEDED_ERRORMESSAGE)%>');
  405. break;
  406. case 8:
  407. SA_DisplayErr ( '<%=SA_EscapeQuotes(L_ZEROSTARTIP_ERRORMESSAGE)%>');
  408. break;
  409. }
  410. }
  411. //Enable the DNS server address text box if dns server listbox contains less than 20 items
  412. function EnableAddText()
  413. {
  414. FrmObj = eval(document.frmTask)
  415. if(FrmObj.cboDNSServers.length>=20)
  416. FrmObj.txtDNS.disabled = true;
  417. else
  418. FrmObj.txtDNS.disabled = false;
  419. }
  420. </script>
  421. <%
  422. End Function
  423. '---------------------------------------------------------------------
  424. ' Function name: UpdateDNSSettingsForNIC
  425. ' Description: To update the DNS Settings for the Network Card.
  426. ' Input Variables: None
  427. ' Output Variables: None
  428. ' Returns: true on success; otherwise false
  429. 'Global Variables: In:G_objService-Getting WMI connection Object
  430. ' In:F_ID-Getting NIC adapter Index
  431. ' In:F_radSelected-Getting radio button selection
  432. ' In:L_(*)-Localization content
  433. '---------------------------------------------------------------------
  434. Function UpdateDNSSettingsForNIC()
  435. Err.Clear
  436. On Error Resume Next
  437. Dim objNetAdapter 'To hold Network adapter object
  438. Dim intReturnValue 'To hold the return value
  439. Dim strSettingId 'To hold the registry setting value
  440. Dim objRegistry 'To hold the registry object
  441. Call SA_TraceOut( SOURCE_FILE, "UpdateDNSSettingsForNIC")
  442. UpdateDNSSettingsForNIC = false
  443. ' Getting the Network adapter objects & DNS servers list
  444. set objNetAdapter = getNetworkAdapterObject(G_objService,F_ID)
  445. strSettingId=objNetAdapter.SettingID
  446. 'Connecting to default namespace to carry registry operations
  447. Set objRegistry=regConnection()
  448. If (objRegistry is Nothing) Then
  449. Call SA_TraceOut( SOURCE_FILE, "Error in getting registry object-UpdateDNSSettingsForNIC()")
  450. SA_ServeFailurePage(L_SERVERCONNECTIONFAIL_ERRORMESSAGE)
  451. UpdateDNSSettingsForNIC = False
  452. Exit Function
  453. End If
  454. 'If the DNS server is to be obtained dynamically
  455. If F_radSelected = "1" Then
  456. 'Check whether DHCP is enabled
  457. If isDHCPEnabled(objNetAdapter) Then
  458. intReturnValue=updateRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" & strSettingID,"NameServer","",CONST_STRING)
  459. Else
  460. SA_SetErrMsg L_DHCPDISABLED_ERRORMESSAGE & "(" & Hex(Err.number) & ")"
  461. Exit Function
  462. End If
  463. Else
  464. 'removing the last comma from dns server list
  465. F_DNSserverList=Mid(F_DNSserverList,1, len(F_DNSserverList)-1)
  466. 'Set the DNS server list in the WMI
  467. intReturnValue=updateRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" & strSettingID,"NameServer",F_DNSserverList,CONST_STRING)
  468. End If
  469. If Err.number <> 0 Then
  470. Call SA_TraceOut( SOURCE_FILE, "DNS settings Not set-UpdateDNSSettingsForNIC()")
  471. Call SA_ServeFailurePage( L_DNSSETTINGSNOTSET_ERRORMESSAGE)
  472. UpdateDNSSettingsForNIC=False
  473. Exit Function
  474. End If
  475. set objNetAdapter = Nothing
  476. UpdateDNSSettingsForNIC = intReturnValue
  477. End Function
  478. '---------------------------------------------------------------------
  479. ' Function name: SetDnsDefaultValues()
  480. ' Description: Setting the dns server default values
  481. ' Input Variables: None
  482. ' Output Variables: None
  483. ' Returns: True if its a success; False otherwise
  484. 'Global Variables: In:G_objService-Getting WMI connection Object
  485. ' Out:F_ID-Getting NIC adapter Index
  486. ' Out:F_radSelected-Getting radio button selection
  487. ' In:L_(*)-Localization content
  488. '---------------------------------------------------------------------
  489. Function SetDnsDefaultValues()
  490. Err.Clear
  491. On Error Resume Next
  492. Dim objNetAdapter 'To hold nic adapter object
  493. Dim objRegistry 'To hold registry object
  494. Dim strNameServer 'To hold the dns servers list
  495. Dim strSettingId 'To hold registry setting id
  496. Const DHCPON="ON" 'Constant for DHCP On
  497. COnst DHCPOFF="OFF" 'Constant for DHCP Off
  498. Const CONSTFLAGNO="No" 'Constant for for flag value
  499. Call SA_TraceOut( SOURCE_FILE, "SetDnsDefaultValues()")
  500. 'Connecting to default namespace to carry registry operations
  501. Set objRegistry=regConnection()
  502. If (objRegistry is Nothing) Then
  503. Call SA_TraceOut( SOURCE_FILE, "Error in getting registry object-SetDnsDefaultValues()")
  504. SA_ServeFailurePage(L_SERVERCONNECTIONFAIL_ERRORMESSAGE)
  505. UpdateDNSSettingsForNIC = False
  506. Exit Function
  507. End If
  508. 'getting dns setting from area page
  509. F_ID = Request.QueryString("PKey")
  510. If F_ID = "" Then
  511. Call SA_TraceOut( SOURCE_FILE, "Dns settings not retrieved-SetDnsDefaultValues()")
  512. Call SA_ServeFailurePage(L_DNSSETTINGSNOTRETRIEVED_ERRORMESSAGE)
  513. SetDnsDefaultValues=False
  514. Exit Function
  515. End If
  516. 'Getting WMI connection Object on error displays failure page
  517. Set G_objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  518. 'To get the Network Adapter object
  519. set objNetAdapter = getNetworkAdapterObject(G_objService,F_ID)
  520. strSettingId=objNetAdapter.SettingID
  521. strNameServer=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" _
  522. & strSettingId,"NameServer",CONST_STRING)
  523. If strNameServer="" and isDHCPenabled(objNetAdapter) then
  524. F_strFlag=CONSTFLAGNO
  525. Else
  526. ''getting the dns server list
  527. F_DNSserverList=strNameServer
  528. End If
  529. 'checking for the DHCP is enabled or not
  530. If isDHCPenabled(objNetAdapter) Then
  531. F_radSelected = DHCPON
  532. Else
  533. F_radSelected = DHCPOFF
  534. End If
  535. SetDnsDefaultValues=True
  536. End Function
  537. '-------------------------------------------------------------------------
  538. ' Function Name: OutputDNSServersToListbox
  539. ' Description: To display the DNS Servers in the LISTBOX.
  540. ' Input Variables: None.
  541. ' Output Variables: None.
  542. ' Returns: None.
  543. ' Global Variables: In: F_DNSserverList - *-separated list of DNS servers IPs
  544. ' This function Outputs DNS servers to the listbox control in the Form.
  545. '-------------------------------------------------------------------------
  546. Function OutputDNServersToListbox()
  547. Err.Clear
  548. On Error Resume Next
  549. Dim arrDnsSrv 'To hold the dns servers list
  550. Dim nIndex 'To hold the array index
  551. arrDnsSrv = split(F_DNSserverList,",")
  552. nIndex = 0
  553. If (NOT IsNull(arrDnsSrv)) Then
  554. If IsArray(arrDnsSrv) Then
  555. For nIndex = LBound(arrDnsSrv) to UBound(arrDnsSrv)
  556. If arrDnsSrv(nIndex) <> "" Then
  557. Response.Write "<OPTION VALUE=""" & arrDnsSrv(nIndex) & _
  558. """ >" & arrDnsSrv(nIndex) & " </OPTION>"
  559. End If
  560. Next
  561. End If
  562. End If
  563. End Function
  564. %>