Sitecore gives a blank page with just the text "Default page" in my MVC solution
Asked Answered
C

3

9

When I browse to my startpage, e.g. /sv I get a blank page that just says "Default Page". However when I try /sv/ it works. Subpages like /sv/example work without slash though. I'm using Sitecore 7.1 with only MVC views.

Crosspiece answered 17/1, 2014 at 10:47 Comment(0)
C
9

When requesting URLs without a slash at the end, the "StripLanguage" processor of the preprocessRequest pipeline rewrites path to the value of the Settings.DefaultPageName setting ("default.aspx" by default). Since such page physically exists on your site, ASP.NET MVC routing system does not handle such request, and the file itself is served. This behavior is controlled over the RouteCollection.RouteExistingFiles property (false by default), please refer to the following article for the details: http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.routeexistingfiles.aspx. In other case, when a slash is added after a language, this won't happen, since the "StripLanguage" processor does not rewrite the path (which is also not an expected behavior). As a result, request URL does not match the "default.aspx" static file in the site and request is getting processed by ASP.NET MVC.

I suggest you to add the following setting to the "Web.config" file (instead of creating a "default.aspx" page), which points to the "default" page without extension:

<settings>
  <setting name="DefaultAspxPageName" value="default"/>
</settings>

After that, the /default URL, without ".aspx" extension, will be processed by MVC and the appropriate item will be rendered independently of a slash after the language URL section. On my side it works.

I want to point out that the answer to this is not my own but given from the support over at Sitecore who I want to extend a big "Thank you!" to. I had googled this forever until they helped me and I thought that I want to have this document and easily found when others struggle with it. A bug is filed and they are working on fixing it.

Crosspiece answered 17/1, 2014 at 10:47 Comment(3)
I couldn't find Settings.DefaultPageName in web.config, I looked in the DLL and the code searches for DefaultAspxPageName, which I couldn't find in config either! Is this just something you added to the config anyway? Either way, no way of finding this without some documentation! Nice find.Radioman
Sort of related (with regards to why "Default" works): nehemiahj.com/2013/11/…Diphtheria
Makes no difference for me. I won't downvote as it seems to help everybody else.Transmit
P
9

Remove the default.aspx file from the web root.
That will fix your problem.

Paisa answered 17/1, 2014 at 11:9 Comment(0)
H
0

DefaultAspxPageName is Hidden Setting.. We can find more such hidden settings..@

http://www.newguid.net/sitecore/2014/sitecore-hidden-string-configuration-settings/

Hovercraft answered 26/3, 2015 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.