Try our conversational search powered by Generative AI!

Change login screen background image

Vote:
 

Hi

Can you change the background image in EpiServer 12 like you can on 11 and prior? 

On 11 and prior you could do it like described here: https://world.optimizely.com/blogs/jacob-pretorius/dates/2019/8/quick-episerver-custom-login-background/ but I can't find any information on how to do it on EpiServer 12.

#314226
Dec 15, 2023 14:38
Ted
Vote:
 

One idea could be some middleware like:

/// <summary>
/// Replaces the original login background image.
/// </summary>
public class LoginBackgroundMiddleware
{
    private readonly RequestDelegate _next;

    public LoginBackgroundMiddleware(RequestDelegate next)
    {
        _next = next;
    }

    public async Task InvokeAsync(HttpContext context)
    {
        if (context.Request.Path.StartsWithSegments("/Util/images/login/login-background-image.png"))
        {
            context.Response.Redirect("https://images.unsplash.com/photo-1509822929063-6b6cfc9b42f2");
        }
        else
        {
            await _next(context);
        }
    }
}

You'd add it to the Configure() method in Startup:

// Custom login background
app.UseMiddleware<LoginBackgroundMiddleware>();

Final result:

#314229
Dec 15, 2023 15:49
Vote:
 

Hi Ted

That's an excellent proposal! I'll try it out.

Thank you!

#314230
Dec 15, 2023 15:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.