日期:2014-05-17  浏览次数:20469 次

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() +"_"