Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
19 stars 15 forks source link

Iframe not found issue #128

Open SokyrkaKyrylo opened 1 month ago

SokyrkaKyrylo commented 1 month ago

Since my last issue report I have made some more investigation and now I`m stuck with the next error:

-- The resource cannot be found 404 () Can u please advise what can I do to resolve this one?
valdisiljuconoks commented 1 month ago

Hi,

Do you have your setup code (Startup.cs) at hand?

wakedupblessed commented 1 month ago

Yep, I have it

ConfigureServices method part:

services.AddNotFoundHandler(o =>
    {
        var connectionString = Configuration.GetConnectionString(AppSettingsConstants.EpiserverDbKey);

        o.UseSqlServer(connectionString);
        o.BufferSize = 30;
        o.ThreshHold = 5;
        o.HandlerMode = FileNotFoundMode.On;
        o.IgnoredResourceExtensions = new[] { "jpg", "gif", "png", "css", "js", "ico", "swf", "woff" };
        o.Logging = LoggerMode.On;
        o.LogWithHostname = false;
    });

    services.AddOptimizelyNotFoundHandler(o =>
    {
        o.AutomaticRedirectsEnabled = true;
    });

    Configure method part: 

    app.UseStatusCodePagesWithReExecute("/statuscode/{0}");

    app.UseNotFoundHandler();

 app.UseEndpoints(endpoints =>
    {
        var openIdOptions = app.ApplicationServices.GetRequiredService<IOptions<AuthenticationOptions>>().Value;

        endpoints.MapControllers();

        endpoints.ConfigureRoutes(openIdOptions);

        endpoints.MapContent();

        endpoints.MapRazorPages();
    });