So my client gave me a MVC site that was created and set up my another vendor. I have never worked with MVC until now so I am learning as I go. I was given a small up date to the site where the client needs a link to PDF, which will then open in the browser window. I added the PDF and added a new route and action in the Controller. The following is the code I added:
Home Controller Code
public ActionResult ViewPDF()
{
return Redirect("Assets/PDF/myPDF.pdf");
}
Route Code
routes.MapRoutesLowercase(
"Home-ViewPDF",
"myPdf.pdf",
new { controller = "Home", action = "ViewPDF" }
);
HTML Code
<a href="<% Url.Action("ViewPDF", "Home") %>"></a>"
Now when I test locally the link works and all is good. When I promote to my Development server I click the link and I get "The page cannot be found". But I know the file is on the server be cause if I type the path in the pdf comes up with no problem.
I have looked every where but cannot find anything online that comes close to what I am looking for, as far as I know that is.
I should note that before I was using Redirect in the Controller I was using a FileResult and returning the File with type application/PDF. However while I was debugging I tried the current method and like I said it worked locally but not on DEV.
Any help would be extremely helpful!! Thanks!