ASP.NET MapPath to the root of the Solution


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?


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,


  • PDF glyph spacing and TJ operator
  • Create Spreadsheet in .NET Compact Framework 3.5
  • How to Get Total Page Count for a Report Using CrystalReportViewer?
  • HQL Inner join on same table
  • How to load space separate file into pandas dataframe?
  • “EntityCollection already initialized” error with entity as model in Asp.Net MVC?
  • SendGrid - Image not showing up in HTML email
  • how to replace string in SpEL expression?
  • Submitting a Hadoop job
  • Trying to delete files older than X number of days on insert in .NET MVC
  • Get entry assembly from ASP.NET application [duplicate]
  • MS Access - How to change the linked table path by amend the table
  • JBoss External Properties Files in Classpath
  • Connect .sks to skscene.h
  • Why does access(2) check for real and not effective UID?
  • Checking free space on FTP server
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Paperclip, set path outside of rails root folder
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Is there any way to access browser form field suggestions from JavaScript?
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • script to move all files from one location to another location
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • ORA-29908: missing primary invocation for ancillary operator
  • How to get next/previous record number?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Acquiring multiple attributes from .xml file in c#
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How does Linux kernel interrupt the application?
  • How can I remove ASP.NET Designer.cs files?
  • Append folder name and increment by 1 using batch script
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal