我想打印以记录有关运行IIS
服务的网站的基本信息。
任何建议/示例如何完成?
答案 0 :(得分:1)
将以下代码添加到页面加载事件,然后导航到页面。您应该找到有用的输出,并且它对于评估Web服务器安全区之间的差异非常有用。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
try
dim outputString as string = string.empty
outputString = "Server: " & HttpContext.Current.Server.MachineName.ToString() & "<br/>"
outputString = outputString & ".Net version: " & Environment.Version.ToString() & "<br/>"
outputString = outputString & "machine config file directory: " & System.web.HttpRuntime.MachineConfigurationDirectory.ToString() & "<br/>"
outputString = outputString & "<br/>"
outputString = outputString & "security principal user: " & System.Security.Principal.WindowsIdentity.GetCurrent().Name & "<br/>"
outputString = outputString & "computer (server) logon user identity: " & Request.LogonUserIdentity.Name & "<br/>"
outputString = outputString & "login in user identity: " & System.Windows.Forms.SystemInformation.UserName.ToString() & "<br/>"
outputString = outputString & "app: " & System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString() & "<br/>"
outputString = outputString & "<br/>"
outputString = outputString & "app version: " & System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() & "<br/>"
outputString = outputString & "windows forms application product version: " & System.Windows.Forms.Application.ProductVersion & "<br/>"
'outputString = outputString & "context items: " & HttpContext.Current.items.ToString() & "<br/>"
outputString = outputString & "app domain id: " & System.web.HttpRuntime.AppDomainAppId.ToString() & "<br/>"
outputString = outputString & "<br/>"
outputString = outputString & "app domain app path: " & System.web.HttpRuntime.AppDomainAppPath.ToString() & "<br/>"
outputString = outputString & "app domain virtual path: " & System.web.HttpRuntime.AppDomainAppVirtualPath.ToString() & "<br/>"
outputString = outputString & "client script physical path: " & System.web.HttpRuntime.AspClientScriptPhysicalPath.ToString() & "<br/>"
outputString = outputString & "client script virtual path: " & System.web.HttpRuntime.AspClientScriptVirtualPath.ToString() & "<br/>"
outputString = outputString & "<br/>"
outputString = outputString & "asp install directory: " & System.web.HttpRuntime.AspInstallDirectory.ToString() & "<br/>"
outputString = outputString & "Common language runtime directory: " & System.web.HttpRuntime.ClrInstallDirectory.ToString() & "<br/>"
outputString = outputString & "Code gen directory: " & System.web.HttpRuntime.CodegenDir.ToString() & "<br/>"
lblOutput.text = outputString
catch ex as exception
lblOutput.text = ex.tostring
end try
End Sub
答案 1 :(得分:0)