Asp.NET获取文件及其路径

相对路径:

  1. Request.ApplicationPath /src
  2. Path.GetDirectoryName (HttpContext.Current.Request.RawUrl ) //src//Xiaoshe
  3. Context.Request.Path /src/Xiaoshe/Xiaoshe_New.aspx
  4. Context.Request.CurrentExecutionFilePath /src/Xiaoshe/Xiaoshe_New.aspx
  5. Context.Request.FilePath /src/Xiaoshe/Xiaoshe_New.aspx
  6. HttpContext.Current.Request.RawUrl /src/Xiaoshe/Xiaoshe_New.aspx
  7. HttpContext.Current.Request.Url http://localhost:1344/src/Xiaoshe/Xiaoshe_New.aspx
  8. TemplateSourceDirectory /src/Controls

绝对路径

  1. Server.MapPath(“./”) E://Wonsoft//Pro2//src//Xiaoshe//
  2. Server.MapPath(“”) E://Wonsoft//Pro2//src//Xiaoshe
  3. Context.Request.PhysicalApplicationPath E://Wonsoft//Pro2//src//
  4. Context.Request.PhysicalPath E://Wonsoft//Pro2//src//Xiaoshe//Xiaoshe_New.aspx
  5. MapPathSecure(TemplateSourceDirectory) E://Wonsoft//Pro2//src//Controls string

其他

Control.ResolveClientUrl(string relativeUrl)
Control.ResolveUrl(string relativeUrl)

你可能感兴趣的:(ASP.NET)