Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • npack 68 posts 378 karma points
    Sep 10, 2024 @ 22:17
    npack
    0

    Is Preview Broken in v14?

    On both my v14 sites, when I click 'Save and Preview' I get sent to a page URL that ends with "&culture=invariant"

    This results in an error:

    CultureNotFoundException: Culture is not supported. (Parameter 'name') invariant is an invalid culture identifier.

    System.Globalization.CultureInfo.GetCultureInfo(string name)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.<DetermineProviderCultureResult>b__4_0(StringSegment culture)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.TryAddLocked(IEnumerable<CultureInfo> supportedCultures, IEnumerable<StringSegment> cultures, object locker, Action<StringSegment> addAction)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.DetermineProviderCultureResult(HttpContext httpContext)
    Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
    

    If I hand-edit the url to include a culture instead of the word 'invariant' then the page opens fine.

    I saw a couple other users here getting this error but their recent comments were buried at the bottom of an old post: https://our.umbraco.com/packages/backoffice-extensions/plumber-workflow-for-umbraco/plumber-workflow-for-umbraco-discussion-and-troubleshooting/108500-error-on-preview-culture-is-not-supported

    Is this a setting, appsetting, machine setting that I have wrong somehow? It is happening on a new single-language umbraco v14 install so it seems out of the box this way.

  • npack 68 posts 378 karma points
    Sep 10, 2024 @ 22:18
    npack
    0

    To clarify, I'm running 14.0.2

  • npack 68 posts 378 karma points
    Sep 12, 2024 @ 22:11
    npack
    0

    Worked around this by adding intercepting and leap-frogging the 'Preview' iframe functionality based on an article https://adolfi.dev/blog/umbraco-preview/

    public class PreviewController : Controller
    {
        [HttpGet]
        [Route("umbraco/preview")]
        public IActionResult Index(string id)
        {
            var requestUrl = new Uri(Request.GetDisplayUrl());
            var leftPart = requestUrl.GetLeftPart(UriPartial.Authority);
            return new RedirectResult($"{leftPart}/{id}");
        }
    }
    

    and in appsettings.json Umbraco Globals

    "ReservedPaths": "~/umbraco/preview"
    

    This also resolved some CORS errors the iframe was introducing, and strips off the &culture=invariant querystring that was causing the error. The drawback is you don't get the different device sizes footer menu.

  • Darren Hunter 146 posts 238 karma points
    Nov 21, 2024 @ 16:17
    Darren Hunter
    0

    I guess this is still broken I am getting this!

    An unhandled exception occurred while processing the request. CultureNotFoundException: Culture is not supported. (Parameter 'name') invariant is an invalid culture identifier.

    System.Globalization.CultureInfo.GetCultureInfo(string name)

    Stack Query Cookies Headers Routing 
    
    CultureNotFoundException: Culture is not supported. (Parameter 'name') invariant is an invalid culture identifier.
        System.Globalization.CultureInfo.GetCultureInfo(string name)
        Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.<DetermineProviderCultureResult>b__4_0(StringSegment culture)
        Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.TryAddLocked(IEnumerable<CultureInfo> supportedCultures, IEnumerable<StringSegment> cultures, object locker, Action<StringSegment> addAction)
        Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.DetermineProviderCultureResult(HttpContext httpContext)
        Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
        Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
        Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
        StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in MiniProfilerMiddleware.cs
        Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
        Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
        Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
        SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, bool retry)
        Umbraco.Forms.Web.HttpModules.ProtectFormUploadRequestsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
        Umbraco.Cms.Api.Management.Middleware.BackOfficeAuthorizationInitializationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
        Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
    

    At the time of posting this we are on 14.3.1

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies