0

I just want my MVC5 Site hosted on godaddy to handle the sitemap.xml file. (mysite.com/sitemap.xml) .

I've seen and followed this post: MVC: How to route /sitemap.xml to an ActionResult?

  1. Added Handler on Web.Config

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

</handlers>

  1. I added a route for my sitemap.xml file:

       routes.MapRoute(
            name: "Sitemap",
            url: "sitemap.xml",
            defaults: new { controller = "Home", action = "SiteMap", id = UrlParameter.Optional }
        );
    
  2. Added the corresponding View and it's controller 3.1 (SiteMap.cshtml on \Views\Home) with some xml contento 3.2 A Home Controller for that:

    public ActionResult SiteMap() { return View(); }

(with just sample xml text)

While running Visual Studio, I can see the localhost:xxxx/sitemap.xml mapping.

I upload it to Godaddy, and then I just get a 404 error (accesing mysite.com/sitemap.xml)

Any clue? Any step I'm missing?

Thanks for your help.

PnP

Community
  • 1
  • 1
PnP
  • 625
  • 1
  • 10
  • 18
  • How do you deploy your application? Did you check that the sitemap file gets uploaded to the server? I'm asking this because if you are publishing with Visual Studio you probably need to mark the file as 'Content'. – Ufuk Hacıoğulları Aug 09 '15 at 20:16
  • I do a Publish --> File Deploy and then upload it via FTP on Godaddy. I checked that the view file is there, the proyect .dll on the bin folder, the same. I checked that everything is upload properly. Thanks! – PnP Aug 09 '15 at 20:59
  • Does changing the handler's path to *.xml help? – Ufuk Hacıoğulları Aug 09 '15 at 21:01
  • Nope, it doens't. And now, I just try with my regular solution on VS and it doens't work. Definitly there is something missing that I can't find. – PnP Aug 10 '15 at 07:22

0 Answers0