Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 820
Mikael Gidmark Avatar asked Jan 17 '14 10:01

Mikael Gidmark


2 Answers

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

like image 67
Ruud van Falier Avatar answered Sep 19 '22 04:09

Ruud van Falier


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.

like image 38
Mikael Gidmark Avatar answered Sep 18 '22 04:09

Mikael Gidmark