1

How do you logout a user from SharePoint if there is no user action or screen remains idle for long time, or is there a way to end user session and redirect him to login page?

2 Answers 2

1

You can modify the time out for your web applications in Central Admin.

Go to Application management > Manage web applications, mark one web application and select General settings from the ribbon.

Scroll down to "Web Page Security Validation"

This is the amount of a time a user can be idle, if they try to access the site again after the time has passed, there will be a security prompt. The default is 30 minutes.

Configure settings for a Web application

4
  • Here it says Security validations expire after a configurable amount of time, requiring the user to retry his operation i just want to confirm does it logs out the user or displays something like try again Commented May 29, 2015 at 11:31
  • It closes the connections to SharePoint, requiring the user to refresh the site. It depends on your browser settings. If the users never need to enter their credentials ( Automatic Logon with current username and password ) then they won't notice anything. If they need to log into SharePoint every time they are trying to access a site, they will need to enter their credentials again. Commented May 29, 2015 at 11:33
  • I need to implement this for FBA Commented May 29, 2015 at 11:36
  • I don't think this works different for FBA. That would be if you are using any custom authentication. Commented May 29, 2015 at 11:41
0

Use a JavaScript in your masterpage which redirects a user after a set interval to the SignOut.aspx page in SharePoint:

$(document).ready(function () {
    idleTime = 0;
    LogOutInactive();
});

function LogOutInactive() {
    var idleInterval = setInterval(timerIncrement, 60000);
    $(this).mousemove(function (e) {
    idleTime = 0;
});

$(this).keypress(function (e) {
        idleTime = 0;
    });
}

function timerIncrement() {
    idleTime = idleTime + 1;
    if (idleTime > 9) {
        window.location = "http://[your site]/_layouts/15/SignOut.aspx";
    }
}
4
  • What if user hits back button in browser he will be redirected to that page, i want to avoid this too Commented May 29, 2015 at 11:40
  • You could add this: <script type="text/javascript">window.history.forward();function noBack(){window.history.forward();}</script> But that will prevent using back on every page, adding an if() which checks the current url can prevent that, but I would not recommend disabling the back button. You could of course write your own custom signout.aspx which in turn redirects the users to any page you like.
    – Quatic
    Commented May 29, 2015 at 11:45
  • security is my main concern, so i want something reliable Commented May 29, 2015 at 11:46
  • Once a user is logged out he will not be automatically logged in again by pushing the back button so I don't see any security vulnerabilities here.
    – Quatic
    Commented May 29, 2015 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.