对于server.mappath我添加了命名空间system.web.ui,即使我没有添加server.mappath [英] for server.mappath i add namespace system.web.ui even though i add the server.mappath does not comes

查看:75
本文介绍了对于server.mappath我添加了命名空间system.web.ui,即使我没有添加server.mappath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));



从下面的代码中,当我输入Server.MapPath时.

你给了解决方案

server.mapapth system.web 命名空间.

即使我添加了名称空间 system.web ,但 server.mappath 都没有出现,请帮助我.是否有任何参考文献想要添加.

请帮我.我尝试几次.

这是我的代码,如下所示



from the below code,when i type Server.MapPath is not coming.

u given the solution

system.web namespace for server.mapapth.

even though i add the namespace system.web the server.mappath does not comes please help me.is there any Reference want to add.

please help me.i try several times .

this is my code as follows

ReportDocument RptDoc = new ReportDocument();
RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));  
RptDoc.SetDataSource(dt);
CrystalReportViewer1.ReportSource = RptDoc;
CrystalReportViewer1.DataBind();



从上面的代码



from the above code

RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));

即使我添加了 system.web.ui 命名空间,此行 Server.MapPath 也不会出现.

this line Server.MapPath does not comes even though i add a system.web.ui namespace.

推荐答案

尝试一下

System.Web.Hosting.HostingEnvironment.MapPath(〜")
Try this

System.Web.Hosting.HostingEnvironment.MapPath("~")


这篇关于对于server.mappath我添加了命名空间system.web.ui,即使我没有添加server.mappath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆