Search code examples
asp.net-mvc-4razorw3crazorengine

W3C validator unable to find link in Razor View


I am using MVC4 project and doing URL rewrite on Server side in RouteConfig and appending .html at the end of url of every page..

www.mysite.com/home.html

I have couple of pages and those pages are linked with home page (every think is working find in browser).

But when i validate using W3C link checker, i get broken link error message.

I really don't know what can be issue. One more thing if i replace .html with .aspx or any other extension it is validated by W3C. I don't know what is issue.

My code is:

 routes.MapRoute(
                name: "features",
                url: "features.html",
                defaults: new { controller = "Home", action = "features", page =    UrlParameter.Optional }
            ); 

Web.config :

"<add name="HtmlFileHandler" path="*.html" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />"

any help is highly appreciated


Solution

  • I replaced
    
    
    <add name="HtmlFileHandler" path="*.html" verb="GET" 
         type="System.Web.Handlers.TransferRequestHandler" 
         preCondition="integratedMode,runtimeVersionv4.0" />
    
    
    with 
    
    
    <add name="HtmlFileHandler" path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory" />
    
    and it works :) 
    
    now My page is validated by W3C.