日期:2014-05-19  浏览次数:20704 次

映射路径的问题?
我的index.htm文件是放在网站的根目录的,可是我用
string   filename   =   HttpContext.Current.Server.MapPath( "/index.htm ");
就会报错,说未能映射路径!

可是我用:
string   filename   =   HttpContext.Current.Server.MapPath( "~/index.htm ");
就是对的?

这个是怎么回事?我的index.htm文件明明放在网址根目录,这2个应该是等效的啊!

------解决方案--------------------
string filename = HttpContext.Current.Server.MapPath( "/index.htm ");

改成

string filename = HttpContext.Current.Server.MapPath( "index.htm ");