This project is read-only.


Configuration in Virtual Directory


When hosting the web application in a virtual directory, the path resolution used to resolve configuration file values fails.


Server.MapPath("App_Data") will resolve to [WebsiteRoot]/App_Data, not [WebsiteRoot]/[MyTrip_VirtualDirectory]\App_Data where the desired configuration file actually resides.

P.S. - This is Bug 1 of 5 (to join the project) =D

file attachments


XamlZealot wrote Oct 17, 2012 at 2:57 PM

Should anyone find this useful:

I resolved the Virtual Directory issue by creating the following static method in mtm.Core\Settings\GeneralMethods.cs:

public static string GetHostingPath()
return HttpContext.Current.Server.MapPath("~");

Then changing all 82 references of HttpContext.Current.Server.MapPath() to call this method and using System.IO.Path.Combine() to create paths to the necessary files:

string absolutDirectory = Path.Combine(GetHostingPath(), "Web.config");

NOTE: Using the ~ will always resolve to the APPLICATION root, not the DOMAIN as long as your virtual directory is configured as an application in IIS, this will resolve to the absolute location of your MyTrip application files.

wrote Oct 17, 2012 at 3:07 PM

wrote Oct 18, 2012 at 8:57 PM

Resolved with changeset 95405.

wrote Oct 18, 2012 at 8:59 PM

wrote Feb 14, 2013 at 3:42 AM

wrote May 16, 2013 at 9:20 AM

wrote May 16, 2013 at 9:20 AM

wrote Jun 14, 2013 at 8:57 AM