<% '================================================== ' Microsoft Server Appliance Kit ' Shares Site Implementation ' Copyright (c) Microsoft Corporation. All rights reserved. '================================================== %> <% Const CONST_VIRTUALROOT = "SOFTWARE\Microsoft\ServerAppliance\ElementManager" ' ' Override the virtual root. For the Shares site, all content is located in the root directory. m_VirtualRoot = "/" '-------------------------------------------------------------------------------------- ' ' This is the localized text section ' '-------------------------------------------------------------------------------------- Dim L_PAGETITLE_TEXT L_PAGETITLE_TEXT = GetLocString("httpsh.dll", "40300001", "") Dim L_PAGETITLE_NOTE_PART_1 L_PAGETITLE_NOTE_PART_1 = GetLocString("httpsh.dll", "40300005", "") Dim L_PAGETITLE_NOTE_PART_2 L_PAGETITLE_NOTE_PART_2 = GetLocString("httpsh.dll", "40300006", "") Dim L_ADMINISTER_TEXT 'L_ADMINISTER_TEXT = "Administer this server appliance" L_ADMINISTER_TEXT = GetLocString("httpsh.dll", "40300002", "") DIM L_NOSHARESAVAILABLE_ERRORMESSAGE L_NOSHARESAVAILABLE_ERRORMESSAGE = GetLocString("foldermsg.dll", "&HC03A001A", "") '-------------------------------------------------------------------------------------- ' ' Here are the registry locations for the admin web site port information ' '-------------------------------------------------------------------------------------- Const CONST_ADMINPORTPATH = "SOFTWARE\Microsoft\ServerAppliance\WebFramework" Const CONST_ADMINPORT = "AdminPort" Const CONST_SSLADMINPORT = "SSLAdminPort" '-------------------------------------------------------------------------------------- Dim strServerName Dim WinNTSysInfo Set WinNTSysInfo = CreateObject("WinNTSystemInfo") strServerName = UCASE( WinNTSysInfo.ComputerName ) Dim objElements Dim objItem Dim G_objRegistry Dim G_iAdminPort Dim G_iSSLAdminPort Dim G_sAdminURL Dim G_sLogoURL Dim G_sIconPath 'Getting registry conection Set G_objRegistry = RegConnection() G_iAdminPort = GetRegKeyValue(G_objRegistry, CONST_ADMINPORTPATH, CONST_ADMINPORT, CONST_DWORD) If (G_iAdminPort = "") Or Not IsNumeric(G_iAdminPort) Then G_iAdminPort = 8099 'Assigning it to default if we don't have one End If 'XPE only has one website, Admin SSL port is the same as the Shares SSL port If CONST_OSNAME_XPE = GetServerOSName() Then G_iSSLAdminPort = GetAdminSiteSSLPort() Else G_iSSLAdminPort = GetRegKeyValue(G_objRegistry, CONST_ADMINPORTPATH, CONST_SSLADMINPORT, CONST_DWORD) End If If (G_iSSLAdminPort = "") Or Not IsNumeric(G_iSSLAdminPort) Then G_iSSLAdminPort = 0 'Assigning it to default if we don't have one End If 'Start of Output - here is the status/branding bar Call ServeStatusBar(False, "", "") %> <%=L_PAGETITLE_TEXT%>
<% Set objElements = GetElements("SharesLogo") For Each objItem in objElements G_sIconPath = objItem.GetProperty("ElementGraphic") If CONST_OSNAME_XPE = GetServerOSName() Then 'Get rid of "../" from the path if it's XPE G_sIconPath = mid(G_sIconPath, 4) End If If ( 0 < Len(Trim(G_sIconPath)) ) Then response.write("") End If Exit For Next %>


<% If (0 < G_iSSLAdminPort) Then G_sAdminURL = "https://" & strServerName & ":" & cstr(G_iSSLAdminPort) & GetAdminSiteVirtualRoot() ElseIf (0 < G_iAdminPort) Then G_sAdminURL = "https://" & strServerName+":" & cstr(G_iAdminPort) & GetAdminSiteVirtualRoot() Else G_sAdminURL = "https://" & strServerName + GetAdminSiteVirtualRoot() End If If CONST_OSNAME_XPE = GetServerOSName() Then G_sAdminURL = G_sAdminURL & "Admin/" End If If ("" <> G_sAdminURL) Then response.write(""+Server.HTMLEncode(L_ADMINISTER_TEXT)+"

") End If %>

<%=L_PAGETITLE_TEXT%>
<% response.write("
"+Server.HTMLEncode(L_PAGETITLE_NOTE_PART_1)+"") response.write(""+Server.HTMLEncode(L_ADMINISTER_TEXT)+"") response.write(Server.HTMLEncode(L_PAGETITLE_NOTE_PART_2)+"

") '-------------------------------------------------------------------------------------- ' ' Here we are getting the list of shares that was saved by the shares area page ' '-------------------------------------------------------------------------------------- Err.Clear On Error Resume Next Dim oFileSystemObject Dim oFile Dim sSharesFolder Dim sShareName Dim bWroteShare Dim strHref Set oFileSystemObject = Server.CreateObject("Scripting.FileSystemObject") 'sSharesFolder = oFileSystemObject.GetSpecialFolder(0).Drive & "\inetpub\shares" sSharesFolder = GetSharesFolder() 'We need to open the file in Unicode read mode to deal with DBCS languages Set oFile = oFileSystemObject.OpenTextFile( sSharesFolder + "\SharesList.txt", 1, False, -2) bWroteShare = False If (0 = Err.number) Then Do While oFile.AtEndOfStream <> True sShareName = oFile.Readline response.write("
") If CONST_OSNAME_XPE = GetServerOSName() Then 'If it's a non-secure request, we add "http", otherwise add "https" to the URL If Request.ServerVariables("SERVER_PORT_SECURE") = 0 Then strHref = "https://" & Request.ServerVariables("Server_name") & ":" & Request.ServerVariables("SERVER_PORT") & "/" & Server.HTMLEncode(sShareName) Else strHref = "https://" & Request.ServerVariables("Server_name") & ":" & Request.ServerVariables("SERVER_PORT") & "/" & Server.HTMLEncode(sShareName) End If response.write(""+Server.HTMLEncode(sShareName)+"
"+vbCrLf) Else response.write(""+Server.HTMLEncode(sShareName)+""+vbCrLf) End If bWroteShare = True Loop End If If Not bWroteShare Then response.write("
"+Server.HTMLEncode(L_NOSHARESAVAILABLE_ERRORMESSAGE)+"
") End If %>
<% Function GetAdminSiteVirtualRoot() GetAdminSiteVirtualRoot = "/admin/" End Function Function GetAdminSiteSSLPort() On Error Resume Next Err.Clear Dim strSitename Dim objService Dim objWebsite Dim strObjPath strSitename = GetCurrentWebsiteName() strObjPath = GetIISWMIProviderClassName("IIs_WebServerSetting") & ".Name=" & chr(34) & strSitename & chr(34) Set objService = GetWMIConnection(CONST_WMI_IIS_NAMESPACE) Set objWebsite = objService.get(strObjPath) If IsIIS60Installed() Then GetAdminSiteSSLPort = objWebsite.SecureBindings(0).Port 'SSL Portnumber stored in WMI has a ":" at the end which we need to get rid of GetAdminSiteSSLPort = Left(GetAdminSiteSSLPort, len(GetAdminSiteSSLPort)-1) Else Dim strIPArr strIPArr=split(objWebsite.SecureBindings(0),":") GetAdminSiteSSLPort = strIPArr(1) End If If Err.number <> 0 Then SA_TraceOut "default.asp", "GetAdminSiteSSLPort(): Error " & Err.Description ' Give the default value GetAdminSiteSSLPort = "8098" End If End Function %>