Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));


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

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


from the above code
C#
RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));
this line Server.MapPath does not comes even though i add a system.web.ui namespace.
Posted
Updated 2-Nov-12 2:11am
v2

1 solution

Try this

System.Web.Hosting.HostingEnvironment.MapPath("~")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900