当前位置: 代码迷 >> ASP.NET >> mvc3 虚构路径
  详细解决方案

mvc3 虚构路径

热度:6158   发布时间:2013-02-25 00:00:00.0
mvc3 虚拟路径
public string UserRoot
  {
  //当前用户文件夹根目录物理路径
  get 
  {
  User user = CurrentUser ();
  string rootPath = System.IO.Path.Combine (System .Web .HttpContext.Current.Server.MapPath ("~/Content"),user.UserID.ToString() +"_"
);
  if (!System .IO .Directory .Exists (rootPath ))
  System.IO .Directory .CreateDirectory(rootPath );
  return rootPath ;
  }
  }

  public string UserRootVirtual(User user)
  {
  //当前用户的文件夹目录虚拟路径
  ??????、
  }
????????我该怎么写

------解决方案--------------------------------------------------------
System.Web.VirtualPathUtility.ToAbsolute("~/Content/" + user.UserID.ToString() +"_")

or

System.Web.VirtualPathUtility.ToAbsolute("~) + "Content/" + user.UserID.ToString() +"_"
  相关解决方案