2

I have created a new folder say XML by using solution explorer. I have added xml and xsl files say a.xsl and b.xml in it. How can I fetch these files by giving relative path?

Example: transform.Load("~/XML/a.xsl"); //load up the stylesheet

But I am getting error here that file not found. When I debug it tries to take file from following path

C:\Program Files\IIS Express\~\XML\PersonnelHTML.xsl'.

Please suggest the solution

2 Answers 2

3

Usually this is resolved using

Server.MapPath(path)

so in your example (assuming the XML folder is at the root level of your site) will be

transform.Load(Server.MapPath("/XML/a.xsl"));  
Sign up to request clarification or add additional context in comments.

Comments

1

try this with the help of Server.MapPath :

 transform.Load(Server.MapPath("~/XML/a.xsl"));  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.