views:

194

answers:

1

I want to provide simple href links to my PDF forms that reside in my Forms folder. I have a created a simple Index.aspx and FormController Index action that simple iterates through the list of PDF files using my FormMetaData.xml file. The links get created just fine but when you click on the links I get a 404 exception. That looks like this:

Server Error in '/' Application.

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Forms/ccindteamgolfform.pdf


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

This seems like this should open up a new browser window with the PDF in it but perhaps I am making a bad assumption. The PDF content files have Build Action of Content and Copy to Output set to Copy Always. Here is an example output html for the link from my Index.aspx page:

   <span class="form">
    <a href="Forms/ccindteamgolfform.pdf" target="_blank">
    <span class="description">Entry Form</span></span>

I must be missing something because this does not work. Do I need to add a MapRoute for these documents? Or am I missing something else with the routing? This seems like it should not be that difficult.

A: 

Might be a stupid question, are you sure the files exist at /Forms/...pdf?

What routes have you registered for use with the FormController? Are you sure that MVC is not intercepting those routes?

Matthew Abbott
Yes, the files are being copied to the Forms folder under the bin. I just have the standard routes registered for my FormController. Here is the routing code: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );
mcbingo
Under bin?So the pdfs exist at /bin/Forms/...pdf?Thats probably why, web applications do not run from /bin, they run from root /, so the forms need to be compied from /bin/Forms to /Forms
Matthew Abbott
Okay, so I made sure that the Forms folder and its content are directly under the root (/) and I still get the same 404 error.
mcbingo
can you post some more code and possibly link in an image of your folder structure, think I need a bit more info
Matthew Abbott