
Question:
I'm having trouble selecting the root of the solution in my ASP.NET Application. I have three applications inside this solution, a Web app, an API and an app for Reports. I was trying to select my Reports app from the Web app in code using Server.MapPath but I can't get to the folder.
I tried Server.MapPath("\Tagus.TMS.Reports/Media/VoyageControlReport.rpt") from inside the web app.
How can I get that app path?
Answer1:The Server.MapPath will use the "application level of IIS" to determine the path returned.
So the path returned is the physcial location of the root of the application (web site) + what ever parameter you pushed into the "MapPath" method.
I would advise you to make a "/Data" directory in your website and use the "Server.MapPath("/Data/dataFileToLoad.rpt") to get the physcial path.
It also gives you a nice isolation for your data files (rpt) versus your runtime files (dll's).
Hope this helps,