Try our conversational search powered by Generative AI!

Navigate to login page when we logout



I want to naviagate to login page when i logout . Is there any way to do it in web.config or global.asax

Feb 18, 2016 15:02

If you're talking about the built-in Logout functionality when you're logged in to edit/admin mode, you could rewrite the logout route handler and append a redirect to your login page. 

Alf has an example of it here:

If you're talking about a custom Logout button that you have in your templates somewhere, you could just add a redirect in your controller when that button is clicked. 

Feb 18, 2016 16:02

No i was talking default episerver logout. It has navigate to my custom login page after logging out.

Edited, Feb 18, 2016 16:17

Unless you want to have one login page for logout, and one login page for first-time login, you can change the loginUrl in web.config
Or do you want to have 2 login pages?

Feb 18, 2016 16:51

<add url="~/util/logout.aspx" mappedUrl="~/Login?ReturnUrl=/" />

I was using this to map url 

and in controller 

public ActionResult Login()
return View(string.Format("~/Views/StartPage/Login.cshtml"));

i am doing this in PageControllerBase class but it doesnt load the css at all in the page

Feb 18, 2016 17:31

Personally I'd use the IIS url rewrite module to redirect "/Util/logout.aspx" to your login page.

Edited, Feb 18, 2016 17:33
* 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.