简体   繁体   中英

Asp.Net MVC Can't get .html files or .xml files 404 error?

How do I return .html files or .xml files that are in folders in the view? I'm using jquery which request a static Html file via ajax and insert the results into a div and it keeps giving a 404 error any idea?

Thanks

If you need to ignore routing for a given path, use:

routes.IgnoreRoute("path/to/static/content");

Also, I may be reading your question wrong, but it's a bad idea to put static content in your View folders. Make a folder like "Content" or "public" at the document root.

If you're actually needing to process a request and spit it out as .html or .xml, make a route that looks like "{controller}/{action}/{id}.xml" or something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM