Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Navigate to login page when we logout

Vote:
 

Hi,

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

#144766
Feb 18, 2016 15:02
Vote:
 

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: http://talk.alfnilsson.se/2014/01/29/hooking-up-to-the-episerver-quicknavigator/

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. 

#144775
Feb 18, 2016 16:02
Vote:
 

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

#144778
Edited, Feb 18, 2016 16:17
Vote:
 

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?

#144782
Feb 18, 2016 16:51
Vote:
 

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

I was using this to map url 

and in controller 

public ActionResult Login()
{
FormsAuthentication.SignOut();
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

#144783
Feb 18, 2016 17:31
Vote:
 

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

#144785
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.