Error when controllerContext.HttpContext.Request.UserLanguages is null


I noticed I was getting a 302 Object Moved error when trying to submit my site to search engines. After looking at it using Fiddler, I determined the error was coming from the ThemeableVirtualPathProviderViewEngine.cs file where it set's the lang variable. I changed it to check for null using:
if (controllerContext.HttpContext.Request.UserLanguages != null)

then set the lang variable.
Hope that helps someone else.
Closed Dec 3, 2015 at 7:40 PM by lordofscripts


lordofscripts wrote Dec 3, 2015 at 7:07 PM

Thanks for the information. I have updated the source code on my repository (hope to upload here as time permits) and made a few other improvements. It now works with .NET 4.5 MVC 5 You can download the latest version as a NuGet package from NuGet.org here.

Now it also properly falls back to the other languages.

wrote Dec 3, 2015 at 7:35 PM

wrote Dec 3, 2015 at 7:40 PM

Resolved with changeset 33219: Fixed and improved

wrote Dec 3, 2015 at 7:56 PM