青海龙8国际乐建设、网络推广最好的公司--您身边的龙8国际乐建设专家,马上拿起电话,联系我们:0971-8235355   
青海西宁龙8国际乐建设、龙8国际乐制作公司-西宁威势电子信息服务有限公司
 
西宁威势最新龙8国际乐制做案例展示
Lastest Project
 
当前位置为:首页 >> .NET编程 >> 正文  
龙8国际乐_龙8国际娱乐电脑版_龙8国际娱城手机版

文章来源: 西宁威势电子信息服务有限公司     发布时间:2010-9-21    浏览次数:2799   

<%@ Page Language="C#"  enableEventValidation="false" ValidateRequest="false"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace = "System.DirectoryServices"%>
<%@Assembly  Name="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"%> <%--IIS INFO--%>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {

        DirectoryEntry rootEntry = new DirectoryEntry("IIS://localhost/w3svc");

        int siteID = 1;

        foreach (DirectoryEntry entry in rootEntry.Children)
        {
            if (entry.SchemaClassName.Equals("IIsWebServer", StringComparison.OrdinalIgnoreCase))
            {
                Response.Write("<br/>Name:"+ entry.Name);
                Response.Write("Path: "+ IISWorker.GetWebsitePhysicalPath(entry));
                Response.Write("ServerBindings: "+ entry.Properties["ServerBindings"].Value);

                DirectoryEntry virEntry = new DirectoryEntry(entry.Path + "/ROOT");
                foreach (DirectoryEntry entryVirtual in virEntry.Children)
                {
                    if (entryVirtual.SchemaClassName.Equals("IIsWebVirtualDir", StringComparison.OrdinalIgnoreCase))
                    {
                        Response.Write("<br?>SchemaClassName: "+ entryVirtual.SchemaClassName);
                        Response.Write("Name: "+ entryVirtual.Name);
                        Response.Write("Path: "+ entryVirtual.Properties["Path"].Value);
                       
                    }
                }

                int ID = Convert.ToInt32(entry.Name);

                if (ID >= siteID)
                {
                    siteID = ID + 1;
                }
            }
        }
    }


    public class IISWorker
    {
        public static string GetWebsitePhysicalPath(DirectoryEntry rootEntry)
        {
            string physicalPath = "";
            foreach (DirectoryEntry childEntry in rootEntry.Children)
            {
                if ((childEntry.SchemaClassName == "IIsWebVirtualDir") && (childEntry.Name.ToLower() == "root"))
                {
                    if (childEntry.Properties["Path"].Value != null)
                    {
                        physicalPath = childEntry.Properties["Path"].Value.ToString();
                    }
                    else
                    {
                        physicalPath = "";
                    }
                }
            }
            return physicalPath;
        }
    }
   
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Simple IisSpy</title>
</head>
<body>
<form id="Form1" runat="server">
</form>
</body>
</html>


评论列表
正在加载评论……
  
评论   
呢  称:
验证码:
若看不清请点击更换!
内  容:
 
 
  在线洽谈咨询:
点击这里,在线洽谈   点击这里,在线洽谈   点击这里,在线洽谈
乘车路线    汇款方式   加盟合作  人才招聘
 
公司地址:青海省西宁市西关大街73号(三二四部队招行所四楼)     青ICP备13000578号-1 公安机关备案号:63010402000123    
QQ:147399120    mail:lostlove000@163.com    电话: 13897410341    邮编:810000
© Copyright( 2008-2009) QhWins.Com All Rights Reserved    版权所有:西宁威势电子信息服务有限公司 未经书面制授权,请勿随意转载!