I am using built-in function UmbracoLoginController. It worked fine with login and logout. But I want to do further as If my ajax calls return 404 or 500, I would like to logout user automatically by showing a message "Your session has been timeout. ..."
Hi Jason
Thanks for replying. My ajax is calling another web api service. ex: UpdateOrderInformation for instance, and this api return a 404 message with whatever. In this case I want to log out user immediately instead using built-in by clicking Logout button.
P/s: Logout built-in function works perfectly. What I want to ask is how to force user log out instead of clicking that button.
I have not tried this but I would imagine that you could do an ajax post to the logout controller url and then just redirect the user to clear auth cookie. You could also create your own controller to log the user out, it is not required the you use the umbraco logout controller, standard form auth stuff. Hope that helps.
Logout manually request
I am using built-in function UmbracoLoginController. It worked fine with login and logout. But I want to do further as If my ajax calls return 404 or 500, I would like to logout user automatically by showing a message "Your session has been timeout. ..."
The code above work fine if user click Logout button. But how to make a request to logout user in this case without clicking on button. Thanks
Are you getting the 404 or 500 when you try to call the logout with JavaScript code? If that is the case could you post you JS script also?
Hi Jason Thanks for replying. My ajax is calling another web api service. ex: UpdateOrderInformation for instance, and this api return a 404 message with whatever. In this case I want to log out user immediately instead using built-in by clicking Logout button.
P/s: Logout built-in function works perfectly. What I want to ask is how to force user log out instead of clicking that button.
I have not tried this but I would imagine that you could do an ajax post to the logout controller url and then just redirect the user to clear auth cookie. You could also create your own controller to log the user out, it is not required the you use the umbraco logout controller, standard form auth stuff. Hope that helps.
Thank you Json. I also found this. Hope this one will help someone else who has the same problem http://24days.in/umbraco/2012/creating-a-login-form-with-umbraco-mvc-surfacecontroller/
is working on a reply...