FormsAuthentication.SignOut () using javascript

Someone please help me solve this problem. In my asp.net application, I am using FormsAuthentication.SignOut (); method to exit the application, but I have one strange requirement that I have to implement FormsAuthentication.SignOut () using the Javascript function. Is it possible? if so, please help me by providing a sample code to achieve this requirement.

Thanks in advance

+3
source share
1 answer

You can use AJAX to “load” a page that calls FormsAuthentication.SignOut.

JQuery, , , "logout".

$('#logout').click(function () {
    $.ajax({
        url: '/logout',
        success: function () {
            document.location = '/logged_out';
        }, error: function () { 
            alert('Logout failed');
        }
    });
    return false;
});
+5

Source: https://habr.com/ru/post/1779372/


All Articles