/// <summary>
/// 扫码通过后跳转到目录浏览界面
/// </summary>
protected void JumpDirectory()
{
//获取iis全部的网站名称和对应的url地址
List<IIsWeb> webs = new List<IIsWeb>();
DirectoryEntry rootEntry = new DirectoryEntry("IIS://localhost/w3svc");
foreach (DirectoryEntry entry in rootEntry.Children)
{
if (entry.SchemaClassName.Equals("IIsWebServer", StringComparison.OrdinalIgnoreCase))
{
IIsWeb web = new IIsWeb();
web.name = entry.Properties["ServerComment"].Value.ToString();//网站名称
web.port = $"{ConfigurationManager.AppSettings["Proj"]}{entry.Properties["ServerBindings"].Value}";//网站端口
webs.Add(web);
}
}
}
效果