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

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

来自微软bwinapp最新版

using System;
using System.DirectoryServices;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryEntry rootEntry = new DirectoryEntry("IIS://localhost/w3svc");

            int siteID = 1;
           
            foreach (DirectoryEntry entry in rootEntry.Children)
            {
                if (entry.SchemaClassName.Equals("IIsWebServer", StringComparison.OrdinalIgnoreCase))
                {
                    Console.WriteLine("Name: {0}", entry.Name);
                    Console.WriteLine("Path: {0}", IISWorker.GetWebsitePhysicalPath(entry));
                    Console.WriteLine("ServerBindings: {0}", entry.Properties["ServerBindings"].Value);
                    Console.WriteLine();

                    DirectoryEntry virEntry = new DirectoryEntry(entry.Path + "/ROOT");
                    foreach (DirectoryEntry entryVirtual in virEntry.Children)
                    {
                        if (entryVirtual.SchemaClassName.Equals("IIsWebVirtualDir", StringComparison.OrdinalIgnoreCase))
                        {
                            Console.WriteLine("SchemaClassName: {0}", entryVirtual.SchemaClassName);
                            Console.WriteLine("Name: {0}", entryVirtual.Name);
                            Console.WriteLine("Path: {0}", entryVirtual.Properties["Path"].Value);
                            Console.WriteLine();
                        }
                    }

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

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

    public class IISWorker
    {
        /// <summary>
        /// 得到bwinapp最新版的物理路径
        /// </summary>
        /// <param name="rootEntry">bwinapp最新版节点</param>
        /// <returns></returns>
        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;
        }
    }
}


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