Click here to Skip to main content
15,913,941 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
string path=Server.MapPath("../Report/rpt/ReportSchema.xsd");

error in c# class in Server.MapPath
Posted
Updated 13-Jan-17 1:55am
v2
Comments
R. Giskard Reventlov 7-Dec-11 2:16am    
So what's the error?

 
Share this answer
 
your question is little bit confusing for me. please be more clear while asking question and also include what error are you getting. whatever
Try
// This will locate the Example.xml file in the App_Data folder.
	// ... (App_Data is a good place to put data files.)
HttpContext.Current.Server.MapPath("~/App_Data/Example.xml")


// This will locate the Example.txt file in the root directory.
	// ... This can be used in a file in any directory in the application.

HttpContext.Current.Request.MapPath("~/Example.txt");


Reference Link:- http://www.dotnetperls.com/mappath[^]
 
Share this answer
 
Hi,
Try this one

C#

string path = Server.MapPath("~/UploadFiles/" + "upload_text.txt");
 
Share this answer
 
v2
try this instead

C#
string path=Server.MapPath("~/Report/rpt/ReportSchema.xsd");


hope it helps!


have a smile :)
 
Share this answer
 
Hi,

when you are using relative path, make sure where your current page exist in directory and where your requested report file exist. depending on that you need to pass parameter in Server.MapPath.

let me know if you need more clarification.

thanks
-Amit.
 
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