我的string FilePath=Server.MapPath("../../Photo/Up/"+UserId+"/"+PhotoPath);
Response.Write(FilePath);//输出C:InetputwwwrootPhotoUp123123.jpgPhotoPath为字符串变量
大家帮我看看,在线等结果啊

解决方案 »

  1.   

    string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/"+PhotoPath);
      

  2.   

    楼上兄弟试过了,结果是C:inetPutwwwrootPhoto~PhotoUp123123
      

  3.   

    FilePath=Server.MapPath("../../Photo/Up/"+UserId+"/"+PhotoPath);
    Response.Write(FilePath);
    FilePath.Substring(FilePath.LastIndexOf("//"));
    //输出C:InetputwwwrootPhotoUp123123.jpg
      

  4.   

    我晕,我看错了。你真大意!!
    string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/") +PhotoPath;
      

  5.   

    哦,刚才错了阿,你要的是路径是把,那你就多加“/”贝,再不行你就Http有一个类阿
      

  6.   

    string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+"/"+PhotoPath);
    string FilePath=Server.MapPath("..//..//Photo//Up//"+UserId+"//"+PhotoPath);
    这样试试.
      

  7.   

    string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/") +PhotoPath;
    结果一样
    Response.Write("<script lanuage=javascript>alert('"+FilePath+"');</script>");
    结果:C:inetPutwwwrootPhoto~PhotoUp123123string FilePath=Server.MapPath("..//..//Photo//Up//"+UserId+"//"+PhotoPath);
    也不行,结果:C:inetPutwwwrootPhotoPhotoUp123123
    string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+"/"+PhotoPath);
    同样
      

  8.   

    怎么用?
    在Application里好像根本没有这个startup方法吧,查了下,vb.NET有
      

  9.   

    string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+@"/"+PhotoPath);