VS2005
未能映射路径,在线急等!!
“/tthr”应用程序中的服务器错误。  
未能映射路径“/hr/img/10537545.jpg”。  
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  
异常详细信息: System.InvalidOperationException: 未能映射路径“/hr/img/10537545.jpg”。  
源错误:  
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  
代码:  
string newext2="";  
string newname2="";  
if((uploadfile.PostedFile!=null)&&(uploadfile.PostedFile.FileName.Trim()!=""))  
{  
string nam = uploadfile.PostedFile.FileName ;  
int i= nam.LastIndexOf(".");  
newext2 =nam.Substring(i);  
DateTime now = DateTime.Now;  
newname2 =now.DayOfYear.ToString() + uploadfile.PostedFile.ContentLength.ToString();  
uploadfile.PostedFile.SaveAs(Server.MapPath("\\hr\\img\\"+newname2+newext2)); //报错行  
}  
注意:  
Server.MapPath("\\hr\\img\\"+newname2+newext2); 里面路径不管怎么改,即使不用hr字样,还是报 未能映射路径“/hr/img/10537545.jpg”错误,从昨天一直调到现在,郁闷了,哪位C#强人帮帮忙吧!!先谢谢了!
------解决方案--------------------
试下这个:
Server.MapPath("~/hr/img/"+newname2+newext2);