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
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
Usually this is resolved using
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"));
在Server.MapPath的帮助下尝试一下:
transform.Load(Server.MapPath("~/XML/a.xsl"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.