DirectoryInfo dir = new DirectoryInfo(Path);
FileSystemInfo[] FileInfo = dir.GetFiles();

解决方案 »

  1.   

    foreach (FileSystemInfo fi in FileInfo)
    {
    fi.Name
    }
      

  2.   

    string[] files() = Directory.GetFiles(directoryPath[, optionalWildCard])
      

  3.   

    请问LS的
    Path那个path如果是远程路径信息的话,可以吗?
    如果可以的话 应该是什么样的格式呢?
      

  4.   

    这个我以前好像问过,要用到Active Directroy.很负责,会遇到方方面面的问题.如果是本地的,用active directory应该很好拿到,如果是远程的,很麻烦,我当时遇到的几个错误一直无法解决.1)RPC服务unavailable2)access问题
      

  5.   

    Managing virtual directories on multiple IIS sites and servers
    http://www.codeproject.com/vb/net/VDirViewer.asp你去看一下
      

  6.   

    用DirectoryEntry类
    System.DirectoryServices.DirectoryEntry Entry = new DirectoryEntry("IIS://IP地址/W3SVC/1/Root");foreach(DirectoryEntry de in Entry.Children)
    {
    if(de.SchemaClassName == "IIsWebVirtualDir")
    {
    if(de.Children != null)
    {
    node = new TreeNode(de.Name);
    tree.Nodes.Add(node); string path = (string)de.Properties["Path"].Value ;
    Dinfo = new DirectoryInfo(path);
    EnumChildren(Dinfo,node); } }
    }
      

  7.   

    学习中.欢迎加入ASP.NET(C#)学习交流QQ群号:32801051
      

  8.   

    using System;
    using System.Net;
    using Microsoft.Win32;
    using System.ServiceProcess;
    using System.DirectoryServices;
    using System.ComponentModel;namespace CommonLogic
    {
    public class IISHelper
    {
    public static readonly string SERVICENAME = "W3SVC"; public IISHelper()
    { } /// <summary>
    /// Get the root of the IIS from the registry.
    /// e.g. C:\Inetpub\wwwroot.
    /// </summary>
    /// <returns></returns>
    public static string GetIISRoot()
    {
    try
    {
    RegistryKey registry = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\InetStp", false);
    return registry.GetValue("PathWWWRoot").ToString();
    }
    catch
    {
    return "";
    }
    } public static bool IsStart()
    {
    return IsStart(GetMachineName());
    } /// <summary>
    /// Check whether the w3svc service start or not.
    /// </summary>
    /// <returns>bool result.</returns>
    public static bool IsStart(string machineName)
    {
    ServiceController controller = new ServiceController(SERVICENAME, machineName);
    if (controller.Status.ToString().ToLower().Contains("run"))
    {
    return true;
    }
    else
    {
    return false;
    }
    } public static string GetMachineName()
    {
    return Dns.GetHostName();
    } public static void Start()
    {
    Start(GetMachineName());
    } public static void Start(string machineName)
    {
    ServiceController controller = new ServiceController(SERVICENAME, machineName);
    controller.Start();
    } public static void Test()
    {
    string entPath = String.Format("IIS://{0}/w3svc/1/Root", "Localhost"); // your computer name.
    DirectoryEntry ent = GetDirectoryEntry(entPath);
    foreach (DirectoryEntry child in ent.Children)
    {
    //if (child.SchemaClassName == "IIsWebServer")
    //{
    //    if (child.Properties["ServerBindings"].Value != null)
    //    {
    //        if (child.Properties["ServerBindings"].Value.ToString() == bindStr)
    //        {
    //            return false;
    //        }
    //    }
    //}
    if (child.Name == "TCMService")
    {
    Console.WriteLine(child.Path);
    //child.Properties[
    }
    //Console.WriteLine(child.Name);
    //Console.WriteLine(child.SchemaClassName);
    //Console.WriteLine(child.Properties["ServerBindings"].Value.ToString());
    }
    } public static DirectoryEntry GetDirectoryEntry(string entPath)
    {
    DirectoryEntry ent; //if (UserName == null)
    //{
    ent = new DirectoryEntry(entPath);
    //}
    //else
    //{
    //    //    ent = new DirectoryEntry(entPath, HostName+"\\"+UserName, Password, AuthenticationTypes.Secure);
    //    ent = new DirectoryEntry(entPath, UserName, Password, AuthenticationTypes.Secure);
    //} return ent;
    }
    }
    }
      

  9.   

    foreach (DirectoryEntry de in Entry.Children)
    运行到这句话的时候出来个COMException异常。。现在还没搞明白。。努力中大家还由什么方法也帮忙指点下阿。。
      

  10.   

    我顶~~~~
    帮忙看看这个异常(COMException 0x80070005)阿
    说什么访问被拒绝

    是不是IIS需要设置什么东东?
    我已经输入账号和密码了。
      

  11.   

    http://www.chinaaspx.com/comm/dotnetbbs/Showtopic.aspx?Forum_ID=5&Id=92558&PPage=1&Page=1
    你的权限不够
      

  12.   

    我现在在做一个资源下载的模块,服务器使用iis存放资源。里面有个文件夹
    但是文件夹里面的文件名称是未知的。如果 这个 文件夹 没开 目录浏览呢你如果 做 资源探测器 的话 要换思路
      

  13.   

    目录浏览??指的是IIS里面那个设置马?
    我开了阿现在就是要求我做个 IIS服务器指定路径的文件夹下面所有存放的文件信息的读取。。
    可以获取里面每个文件的日棋、大小。。然后通过一定的规律和本机 当前存放的对应文件用时间和大小进行比较。。如果本地的文件和服务器上地不一致就要求下载下来。。
      

  14.   

    TO:MatrixB(大头)
    你说得那篇文章的图片无法显示。他设置的是office权限的例子
    我的应该如何设置服务器的权限呢?
    都需要设置什么权限呢??