网站程序ASP.NET的后台程序路径在临时文件夹哪个文件里

2007年11月 .NET技术大版内专家分月排行榜第三
2008年11月 MS-SQL Server大版内专家分月排行榜第三2008年10月 MS-SQL Server大版内专家分月排行榜第三2006年7月 MS-SQL Server大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。asp.net下的文件路径的:获得虚拟目录的网站的根目录
string Server.MapPath(string path)
  返回与Web服务器上的指定虚拟路径相对应的物理文件路径。
  Server.MapPath(Request.ServerVariables[&PATH_INFO&])
   Server.MapPath(&/&)
   Server.MapPath(&&)
  Server.MapPath(&.&)
   Server.MapPath(&../&)
   Server.MapPath(&..&) 
&&&&&& Page.Request.ApplicationPath
&&&&&& (HttpContext.Current.Request.PhysicalApplicationPath);&&
  以上的代码在http://localhost/EnglishClub/manage/WebForm1.aspx页面
  运行结果:
  C:\Inetpub\wwwroot\EnglishClub\manage\WebForm1.aspx
  C:\Inetpub\wwwroot\
  C:\Inetpub\wwwroot\EnglishClub\manage
  C:\Inetpub\wwwroot\EnglishClub\manage
  C:\Inetpub\wwwroot\EnglishClub\
  C:\Inetpub\wwwroot\EnglishClub
 & C:\Inetpub\wwwroot\EnglishClub\
由以上可以知道:
要想获得要是建立的虚拟目录的网站的根目录可以这样使用:
Server.MapPath(Page.Request.ApplicationPath)
摘自 清风333//获取当前进程的完整路径,包含文件名(进程名)。&& string str = this.GetType().Assembly.L&& result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)&&
//获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。&& string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileN&& result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)&&
//获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。&& string str = System.Environment.CurrentD&& result: X:\xxx\xxx (.exe文件所在的目录)&&
//获取当前 Thread 的当前应用程序域的基目录,它由程序集冲突解决程序用来探测程序集。&& string str = System.AppDomain.CurrentDomain.BaseD&& result: X:\xxx\xxx\ (.exe文件所在的目录+"\")&&
//获取和设置包含该应用程序的目录的名称。&& string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationB&& result: X:\xxx\xxx\ (.exe文件所在的目录+"\")&&
//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。&& string str = System.Windows.Forms.Application.StartupP&& result: X:\xxx\xxx (.exe文件所在的目录)&&
//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。&& string str = System.Windows.Forms.Application.ExecutableP&& result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)&&
//获取应用程序的当前工作目录(不可靠)。&& string str = System.IO.Directory.GetCurrentDirectory();&& result: X:\xxx\xxx (.exe文件所在的目录)&
//获取当前进程的完整路径,包含文件名(进程名)。string str = this.GetType().Assembly.Lresult: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileNresult: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。string str = System.Environment.CurrentDresult: X:\xxx\xxx (.exe文件所在的目录)
//获取当前 Thread 的当前应用程序域的基目录,它由程序集冲突解决程序用来探测程序集。string str = System.AppDomain.CurrentDomain.BaseDresult: X:\xxx\xxx\ (.exe文件所在的目录+"\")
//获取和设置包含该应用程序的目录的名称。string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBresult: X:\xxx\xxx\ (.exe文件所在的目录+"\")
//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。string str = System.Windows.Forms.Application.StartupPresult: X:\xxx\xxx (.exe文件所在的目录)
//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。string str = System.Windows.Forms.Application.ExecutablePresult: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取应用程序的当前工作目录(不可靠)。string str = System.IO.Directory.GetCurrentDirectory();result: X:\xxx\xxx (.exe文件所在的目录)
.NET中三种获取当前路径的代码
//Web编程&& HttpContext.Current.Server.MapPath("FileName")&& System.Web.HttpContext.Current.Request.Path&&
//Windows编程&& System.Environment.CurrentDirectory&&
//Mobile编程&& Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
阅读(...) 评论()增值电信业务经营许可证:苏B2-CopyRight ©
All Rights reserved.正文 asp.net获取网站目录物理路径
asp.net获取网站目录物理路径
发布时间: & 编辑:
分享一个asp.net获取网站目录物理路径的方法,很实用的例子。
string rootPath1= Server.MapPath(&~&);
string rootPath2 = Request.ApplicationP
string path1 = Server.MapPath(&upload&);
string path2 = Server.MapPath(&&);
string path3 = Server.MapPath(&.&);
string path4 = Server.MapPath(&..&);
string path5 = Server.MapPath(Request.ServerVariables[&PATH_INFO&]);
输出结果:
复制代码 代码示例:
string rootpath1= &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\cfzs\\Web&;
string rootpath2= &/Web&;
string path1 = &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\view\\Atlas\\upload\\cfzs\\Web\\view\\Atlas\\upload&;
string path2 = &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas&;
string path3 = &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas&;
string path4 = &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\view\\cfzs\\Web\\view&;
string path5 = &F:\\ASP.NET_Projects\\超凡装饰\\cfzs\\Web\\view\\Atlas\\Add.aspx\\cfzs\\Web\\view\\Atlas\\Add.aspx&;您可能感兴趣的文章:

我要回帖

更多关于 mac 应用程序路径 的文章

 

随机推荐