SaaS CMS has officially launched! Learn more now.

Upgrade to .net 6 and latest version of Optimizely, custom login doesn't work


After upgrading to the latest version of optimizely my custom login/logout doesn't work properly anymore and the path for login that is set in startup it goes to :


 app.UseEndpoints(endpoints =>
                endpoints.MapControllerRoute("CustomLogin", "login/",
                    new { controller = "IdentityServerAuthentication", action = "Login" });
                endpoints.MapControllerRoute("CustomLogout", "logout/",
                    new { controller = "IdentityServerAuthentication", action = "Logout" });

                endpoints.MapControllerRoute(name: "Default", pattern: "{controller}/{action}/{id?}");

The same code was working in .net 5 and CMS 11 :-) Anyone has any idea how to solve this?

Best Regards


Nov 23, 2022 2:57

Hi, we would need more information to be able to help. You write that the login path is /util/Login, but the endpoints in your posted code is mapped to /login. What are you trying to achive, remap /util/login so it uses IdentityServer, or do you want to change the login URL for the whole application to use /login instead? Does the login work if you navigate to /login?

Nov 23, 2022 8:24
Maryam Sarrafkia - Nov 23, 2022 8:48

I would like to use identity server login and remap util/login to /login. The code above was doing doing the remapping correctly in previous version.
/login is going to identity server login page.

Best regards

You can change the login path, to not use /util/login, in the cookie auth scheme:

services.Configure<CookieAuthenticationOptions>(o => o.LoginPath = "/login");

or directly when you configure the authentication schemes:

    .AddCookie(options =>
        options.LoginPath = "/login";
Nov 23, 2022 9:10
Maryam Sarrafkia - Nov 23, 2022 13:13
Sure this has been added since beginning to the identity server part of the code at start up but some how util/login is overriding it and I don't know how it is possible :-) Should look in to it more!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.