I have a file, eulatest.pdf
, that I want to be able to view through my website. At this point I don't really care whether it's at mywebsite.com/eulatest.pdf
or mywebsite.com/eula/eulatest.pdf
or any variation; I can't get any of these to work. How can I view this file? I'm not even trying to access it through code; I just can't figure out where it is or how to access it at all.
I keep getting this error:
And I've tried putting the file in all of these locations:
You need to add an action in one of your controllers to stream out that file.
public class EULAController : Controller
{
public ActionResult Index()
{
return File("eulatest.pdf","application/pdf");
}
}
Assuming the file is in the root folder of your application. For more on File checkout this
If this is in EULA Controller use:
mywebsite.com/eula/
Alternatively you can add that file to ignore lists in your route mapping.