Copied to clipboard

Flag this post as spam?

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


  • Joyce 3 posts 73 karma points
    Apr 14, 2023 @ 20:50
    Joyce
    0

    Troubleshooting HTTP ERROR 500

    Hello Umbraco community,

    I'm experiencing an HTTP error 500 on my website after making updates in the CMS. I'm not sure which updates caused the issue, but it happened after I updated various elements including the home page, header, and the blog.

    I find it strange that the error is not a 404 page, which would be typical for a missing page. Instead, something seems to have gone wrong in the CMS that severed my site from the server. I’ve been directed by my IT department to double check the home page as that’s where the issue originated.

    When I checked the Umbraco logs I found the following error message:

     --------- umbraco error log -------------------------------
    Connection id ""0HMPSNC39JICD"", Request id ""0HMPSNC39JICD:00000025"": An unhandled exception was thrown by the application.
    
    System.ArgumentNullException: Value cannot be null. (Parameter 'input')
       at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
       at System.Text.RegularExpressions.Regex.IsMatch(String input)
       at AspNetCore.Views_Partials_components_mediaElement.getBrowser() in /home/site/wwwroot/Views/Partials/components/mediaElement.cshtml:line 205
       at AspNetCore.Views_Partials_components_mediaElement.getVideoUrl(MediaWithCrops video, MediaWithCrops videoMp4) in /home/site/wwwroot/Views/Partials/components/mediaElement.cshtml:line 193
       at AspNetCore.Views_Partials_components_mediaElement.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/mediaElement.cshtml:line 102
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_renderComponents.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/renderComponents.cshtml:line 5
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_tabSlider.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/tabSlider.cshtml:line 319
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_renderComponents.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/renderComponents.cshtml:line 5
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_column.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/column.cshtml:line 44
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_row.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/row.cshtml:line 38
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Partials_components_section.ExecuteAsync() in /home/site/wwwroot/Views/Partials/components/section.cshtml:line 42
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions.Partial(IHtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at AspNetCore.Views_Page.ExecuteAsync() in /home/site/wwwroot/Views/Page.cshtml:line 9
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
       at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
       at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Umbraco.Cms.Web.BackOffice.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
       at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
       at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 121
       at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at SeoToolkit.Umbraco.Redirects.Core.Middleware.RedirectMiddleware.Invoke(HttpContext context)
       at SeoToolkit.Umbraco.RobotsTxt.Core.Middleware.RobotsTxtMiddleware.Invoke(HttpContext context)
       at SeoToolkit.Umbraco.Sitemap.Core.Middleware.SitemapMiddleware.Invoke(HttpContext context, ISitemapGenerator sitemapGenerator, ISitemapIndexGenerator sitemapIndexGenerator)
       at Umbraco.Forms.Web.HttpModules.ProtectFormUploadRequestsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at foss.Middlewares.CustomHeaders.InvokeAsync(HttpContext context) in /home/foss/agent/_work/41/s/src/Middlewares/CustomHeaders.cs:line 22
       at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TConte
    

    I'm not sure how to proceed in resolving this error, so any guidance or advice would be greatly appreciated. Thank you in advance for your help.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Apr 15, 2023 @ 06:06
    Huw Reddick
    0

    Your error is in this partial file Mediaelement what is on the line indicated in the error?

  • Joyce 3 posts 73 karma points
    Apr 15, 2023 @ 07:02
    Joyce
    0

    Hi, this is what I found under partial views > components > mediaElement line 205

    enter image description here

    The full code is here:

    @using Umbraco.Cms.Core.Models.Blocks;
    @using Umbraco.Cms.Core.Models;
    @using System.Text.RegularExpressions
    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<BlockListItem>
    
    @{
      var element = Model.Content;
      var settings = Model.Settings;
    
      var dVisibility = settings?.GetProperty("desktopVisibility").GetValue()?.ToString();
      var mVisibility = settings?.GetProperty("mobileVisibility").GetValue()?.ToString();
      var desktopVisibility = dVisibility == "Yes" || dVisibility == null || dVisibility == "1";
      var mobileVisibility = mVisibility == "Yes" || dVisibility == null || dVisibility == "1";
      if (!desktopVisibility && !mobileVisibility) return;
    
      var id = (string)settings.GetProperty("itemName").GetValue();
      var classNames = "fs-media-element " + (string)settings.GetProperty("classNames").GetValue();
    
      var idAttribute = id != null && id.Length > 0 ? $" id=\"{id}\"" : "";
    
      if (desktopVisibility ^ mobileVisibility)
      {
        if (desktopVisibility) classNames += " fs-hide-mobile";
        else classNames += " fs-hide-desktop";
      }
    
      var mediaType = (string)settings?.GetProperty("mediaType").GetValue();
      var playIcon = (MediaWithCrops)settings?.GetProperty("playIcon").GetValue();
      var pauseIcon = (MediaWithCrops)settings?.GetProperty("pauseIcon").GetValue();
      var desktopImage = (MediaWithCrops)settings?.GetProperty("image").GetValue();
      var desktopMaskImage = (MediaWithCrops)settings?.GetProperty("maskImage").GetValue();
      var figureCaption = (string)settings?.GetProperty("figureCaption").GetValue();
      var uploadVideo = (MediaWithCrops)settings?.GetProperty("video").GetValue();
      var uploadVideoMp4 = (MediaWithCrops)settings?.GetProperty("videoMP4").GetValue();
      var videoURL = (string)settings?.GetProperty("videoURL").GetValue();
      var mobileImage = (MediaWithCrops)settings?.GetProperty("mobileImage").GetValue();
      var mobileMaskImage = (MediaWithCrops)settings?.GetProperty("mobileMaskImage").GetValue();
      var poster = (MediaWithCrops)settings?.GetProperty("poster").GetValue();
      var popupClass = (string)settings?.GetProperty("popupClass").GetValue();
    
      string[] videoOption;
    
      try
      {
        videoOption = (string[])settings?.GetProperty("videoOptions").GetValue();
      }
      catch (Exception)
      {
        videoOption = Array.Empty<string>();
      }
    
      var breakpoint = 767;
    
      switch (mediaType)
      {
        case "Image":
          <div class="@classNames.ToLower() fs-media-element--image" @Html.Raw(idAttribute)>
            @{
          renderMaskImage(element.Key.ToString(), mobileMaskImage, desktopMaskImage, breakpoint);
          renderImage(mobileImage, desktopImage, breakpoint, figureCaption);
            }
          </div>
          break;
        case "Uploaded Video":
          var videoOptionsText = String.Join(" ", videoOption).ToLower();
          var isAutoplay = Array.Find(videoOption, o => o.InvariantEquals("autoplay")) != null;
          var hasControls = Array.Find(videoOption, o => o.InvariantEquals("controls")) != null;
          <div class="@classNames.ToLower() fs-media-element--uploaded-video" @Html.Raw(idAttribute)>
            <div class="fs-media-element__video-wrapper @(isAutoplay ? "playing" : "paused")">
              <video @videoOptionsText poster="@poster?.Url()">
                <source src="@getVideoUrl(uploadVideo, uploadVideoMp4)">
                Your browser does not support HTML5 video.
              </video>
              @if (!hasControls)
              {
                if (playIcon != null)
                {
                  <span class="fs-media-element__video-play-icon" style="background-image: url('@playIcon.Url()')"></span>
                }
                if (pauseIcon != null)
                {
                  <span class="fs-media-element__video-pause-icon" style="background-image: url('@pauseIcon.Url()')"></span>
                }
              }
            </div>
          </div>
          break;
        case "Video Link":
          <div class="@classNames.ToLower() fs-media-element--video-link" @Html.Raw(idAttribute)>
            <iframe title="Video previewer" src="@videoURL"></iframe>
          </div>
          break;
        case "Popup uploaded Video":
        case "Popup Video Link":
          <div class="@classNames.ToLower() fs-media-element--popup-video" @Html.Raw(idAttribute)>
            <a @Html.Raw(String.IsNullOrEmpty(popupClass) ? "" : $"data-popup-class=\"{popupClass}\"") data-fancybox href="@(mediaType == "Popup uploaded Video" ? getVideoUrl(uploadVideo, uploadVideoMp4) : videoURL)">
              <figure>
                <img alt="popup video poster" src="@poster?.Url()"/>
              </figure>
              @if (playIcon != null)
              {
                <span class="fs-media-element__video-play-icon" style="background-image: url('@playIcon.Url()')"></span>
              }
            </a>
          </div>
          break;
      }
    
    }
    
    
    @functions
    {
    
      private void renderMaskImage(string id, MediaWithCrops? mobileMaskImage, MediaWithCrops? desktopMaskImage, int breakpoint)
      {
        if (mobileMaskImage == null && desktopMaskImage == null)
        {
          return;
        }
        <div class="fs-media-element__mask fs-media-element__mask--@id"></div>
        <style>
          @if (mobileMaskImage != null && desktopMaskImage != null)
          {
            <text>
              .fs-media-element__mask--@id {
                background-image: url("@mobileMaskImage.Url()");
              }
              @@media (min-width: @(breakpoint + 1)px) {
                .fs-media-element__mask--@id {
                  background-image: url("@desktopMaskImage.Url()");
                }
              }
            </text>
          }
          else
          {
            <text>
             .fs-media-element__mask--@id {
                @if (mobileMaskImage != null)
                {
                  <text>background-image: url("@mobileMaskImage.Url()");</text>
                }
                else
                {
                  <text>background-image: url("@desktopMaskImage.Url()");</text>
                }
             }
            </text>
          }
        </style>
      }
    
      private void renderImage(MediaWithCrops mobileImage, MediaWithCrops desktopImage, int breakpoint, string figureCaption)
      {
        <figure class="fs-media-element__figure">
          <picture>
            @if (mobileImage != null)
            {
              @if (desktopImage != null)
              {
                <source srcset="@mobileImage.Url()" media="(max-width: @(breakpoint)px)"/>
                <img class="img-fluid" alt="image - @desktopImage.Name" src="@desktopImage.Url()"/>
              }
              else
              {
                <img alt="image - @mobileImage.Name" src="@mobileImage.Url()"/>
              }
            }
            else
            {
              if (desktopImage != null)
              {
                <img alt="image - @desktopImage.Name" class="img-fluid" src="@desktopImage.Url()"/>
              }
              else
              {
                <img src="https://via.placeholder.com/300.png" class="img-fluid" alt="placeholder image"/>
              }
            }
          </picture>
          @if (!String.IsNullOrEmpty(figureCaption))
          {
            <figcaption class="fs-media-element__fig-caption">@figureCaption</figcaption>
          }
        </figure>
      }
    
      private string? getVideoUrl(MediaWithCrops? video, MediaWithCrops? videoMp4)
      {
        if (video is null) return videoMp4?.Url();
        if (videoMp4 is null) return video.Url();
        return getBrowser().Equals("safari") ? videoMp4.Url() : video.Url();
      }
    
      private string getBrowser()
      {
        var userAgent = Context?.Request?.Headers?.UserAgent;
        if (userAgent is null) return "unknown";
        if (Regex.IsMatch(userAgent, "chrome|chromium|crios", RegexOptions.IgnoreCase)) return "chrome";
        if (Regex.IsMatch(userAgent, "firefox|fxios", RegexOptions.IgnoreCase)) return "firefox";
        if (Regex.IsMatch(userAgent, "safari", RegexOptions.IgnoreCase)) return "safari";
        if (Regex.IsMatch(userAgent, "opr", RegexOptions.IgnoreCase)) return "opera";
        if (Regex.IsMatch(userAgent, "edg", RegexOptions.IgnoreCase)) return "edge";
        return "unknown";
      }
    
    }
    
  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Apr 15, 2023 @ 10:59
    Huw Reddick
    0

    somethin is not being set and then used when it is null, so you will need to try and figure out what, maybe one of your properties changed name or something

  • Joyce 3 posts 73 karma points
    Apr 15, 2023 @ 17:33
    Joyce
    0

    What does it mean when something is null? And how would I figure this out in my properties?

Please Sign in or register to post replies

Write your reply to:

Draft