关于Server.MapPath,在线等结果

wangwei155 2006-09-08 03:42:30
我的string FilePath=Server.MapPath("../../Photo/Up/"+UserId+"/"+PhotoPath);
Response.Write(FilePath);//输出C:InetputwwwrootPhotoUp123123.jpg

PhotoPath为字符串变量
大家帮我看看,在线等结果啊


...全文
285 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangwei155 2006-09-09
  • 打赏
  • 举报
回复
哦,这样啊,谢谢
结贴吧
chaircat 2006-09-09
  • 打赏
  • 举报
回复
只有不希望\转义的时候才要用到@符号...
现在只用到了/而已...需要@么...
vshake 2006-09-09
  • 打赏
  • 举报
回复
string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+@"/"+PhotoPath);
wangwei155 2006-09-09
  • 打赏
  • 举报
回复
没人吗,继续顶
wangwei155 2006-09-08
  • 打赏
  • 举报
回复
怎么用?
在Application里好像根本没有这个startup方法吧,查了下,vb.NET有
wthorse 2006-09-08
  • 打赏
  • 举报
回复
用application.startup吧
wangwei155 2006-09-08
  • 打赏
  • 举报
回复
string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/") +PhotoPath;
结果一样
Response.Write("<script lanuage=javascript>alert('"+FilePath+"');</script>");
结果:C:inetPutwwwrootPhoto~PhotoUp123123

string FilePath=Server.MapPath("..//..//Photo//Up//"+UserId+"//"+PhotoPath);
也不行,结果:C:inetPutwwwrootPhotoPhotoUp123123
string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+"/"+PhotoPath);
同样
wangwei155 2006-09-08
  • 打赏
  • 举报
回复
感激不尽,我试试
blueice008 2006-09-08
  • 打赏
  • 举报
回复
string FilePath=Server.MapPath(@"../../Photo/Up/"+UserId+"/"+PhotoPath);
string FilePath=Server.MapPath("..//..//Photo//Up//"+UserId+"//"+PhotoPath);


这样试试.
Ice_wang 2006-09-08
  • 打赏
  • 举报
回复
哦,刚才错了阿,你要的是路径是把,那你就多加“/”贝,再不行你就Http有一个类阿
v192 2006-09-08
  • 打赏
  • 举报
回复
我晕,我看错了。你真大意!!
string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/") +PhotoPath;
Ice_wang 2006-09-08
  • 打赏
  • 举报
回复
FilePath=Server.MapPath("../../Photo/Up/"+UserId+"/"+PhotoPath);
Response.Write(FilePath);
FilePath.Substring(FilePath.LastIndexOf("//"));
//输出C:InetputwwwrootPhotoUp123123.jpg
wangwei155 2006-09-08
  • 打赏
  • 举报
回复
楼上兄弟试过了,结果是C:inetPutwwwrootPhoto~PhotoUp123123
v192 2006-09-08
  • 打赏
  • 举报
回复
string FilePath=Server.MapPath("~/Photo/Up/"+UserId+"/"+PhotoPath);

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧