Application.StartupPath???
C# winform 开发群,群号:57718204,我们期待您的加入!!

解决方案 »

  1.   

    using System.Windows.Forms;  命名空间Application.ExecutablePath;  包括可执行文件名称Application.StartupPath; 不包括打执行文件名称  
      

  2.   

    Application.ExecutablePath  //包括可執行文件的名稱
    Application.StartupPath     //不包括可執行文件的名稱
      

  3.   

    如果是asp.net环境,请使用Server.MapPath("./Model.htm")
      

  4.   

    webform:
    Server.MapPath("~")winform:
    Application.StartupPath
      

  5.   

    楼主问的是WEB还是桌面软件?
    上面的几位把答案都列出来了。
      

  6.   

    .net2008相关技术,sliverlight,linq,db  开发群,群号:39698106
      

  7.   


    '当前应用程序所在的目录路径
    System.Environment.CurrentDirectory'当前应用程序的绝对路径
    System.Windows.forms.Application.ExecutablePath;
      

  8.   

    using System.Windows.Formsstring 路径=Application.StartupPath
      

  9.   

    Application.StartupPath  这个是肯定可以的。你再好好看看你的代码是不是出了什么问题,或者贴出相关代码大家看一看
      

  10.   

    string strAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
                    ......
      

  11.   

    string strAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
                    ......
      

  12.   

    '当前应用程序所在的目录路径 
    System.Environment.CurrentDirectory '当前应用程序的绝对路径 
    System.Windows.forms.Application.ExecutablePath;
    注意:LZ,你Debug的时候,这个路径是指到你项目做的文件夹的debug\bin这的
    可以不要以为是在项目的文件夹.那肯定就不对了噻