I have created an Area for XForms and when I try to return view(“index.xhtml”) the framework resolves the view as index.xhtml.aspx or index.xhtml.cshtml.
I tried routes.IgnoreRoute(“{resource}.*xhtml/{*pathinfo}”); in global.asax.
Either I am not sure what URL to use (am I still hitting the controller or going straight at the .xhtml file in the views folder?) OR I made a mistake in my ignoreroute.
Any help appreciated.
If you are trying to have the action just write the content of
index.xhtml, you’ll need to doreturn File("index.html", "application/xhtml+xml").View/PartialViewassume you want the specified view file parsed and executed using the currently configured view engine.You can’t/shouldn’t put static files you want remote users to be able to hit directly in your
~/Viewsfolder. MVC places a web.config file in this folder that prevents files in this location from being served.So, either have your controller action return the file as I mentioned above, or move the xhtml files into some other folder in your application that is not restricted. Then your route should work and your files should be served statically.