I would like to have a /downloads folder inside an Orchard web app where I can direct clients to so they can download files ie. http://www.mydomain.com/downloads/test.txt
In IIS I have created a virtual directory (not an Application) underneath the Orchard website that points to the downloads folder on the server.
In the Orchard Global.ascx file, I’ve added the following, thinking that it was a routing problem:
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("downloads/{*pathInfo}"); // added this IgnoreRoute
}
Not 100% sure if this is required.
However, when I go to download the file, http://www.mydomain.com/downloads/test.txt, I continue to receive a 404 error.
Found the fix thanks to this post: http://orchard.codeplex.com/discussions/280041
Firstly, it needed to be an application under the Orchard website, rather than just a virtual directory. In IIS you can right click on the virtual directory > convert to Application.
After that, the issue is that the web.config in Orchard propagates to the child applications. To stop this, you need to add
<location path="." inheritInChildApplications="false">around both the<system.web>and<system.webserver>nodes in Orchard’s web.config file. You can read more on the location tag here.After making those changes, I can then successfully download my test.txt file with no problems.