Try our conversational search powered by Generative AI!

Custom Authentication and redirect


I have a problem that I hope someone can help me with.
I needed to make a custom authentication-handler on a cms5-site. So I changed authentication-settings in web.config to this:

<authentication mode="Forms">
   <forms loginUrl="templates/MyOwnLogin.aspx" name=".EPiServerLogin" timeout="480" />


In my authenticator I want the standard episerver authenticator to handle logins to edit and admin-mode so I added this code:

if (url.StartsWith("/login/"))
     Response.Redirect("/util/login.aspx?" + Request.QueryString, false);

This work as intended. The problem is that when you get redirected to the standard episerver-login, and you enter usr/pwd and submit, you are not redirected to the returnurl in the querystring. It seems like nothing happens, but you have actually been authenticated and you can go to edit- or admin-mode manually by entering the url.

Has anyone experienced this before? Or does anyone know of a better way to implement Login-interception?

best regards,
Frank Johannessen

Nov 06, 2012 10:10

you need to hook into ther on_loggedin event i think is what it is called.  then you will get what you need.  You can also setup your login url to any page you want and add the <asp:Login control to the page as that is what episerver uses as well.  You can also use a control adapter as well for the login control.  Many ways to do this.

Edited, Dec 08, 2012 5:17
* 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.