0

How to log out all active user from my asp.net application .net framework 4.0 version at particular time in every day with a popup notification.

Darshan Lila
  • 5,772
  • 2
  • 24
  • 34
Sumit Manna
  • 541
  • 1
  • 5
  • 16

2 Answers2

0

There is no easy way to implement it but i think SignalR kind of technology will help you to achieve this http://www.asp.net/signalr . Otherwise write a polling ajax call to your server side and keep this code in master page after login. Once server side indicates that user need to logout, show the alert box and redirect to logout page.

Use the JavaScript timer to call this method every 5 or 10 seconds.

                $.ajax({
                  url : 'DoWeNeedToLogout.ashx',
                  type : 'GET',
                  success : function(result) {
                                if(result == "YES")
                                      alert('We are about to logut');
                                      window.location = 'logoutpage.aspx';
                            }
                });

Simple create Generic http handler

                    public class DoWeNeedToLogout : IHttpHandler {

                         public void ProcessRequest(HttpContext context) {
                              // Do some logic here and return
                             if(OK)
                               context.Response.Write("YES");
                          }
                     }
Devesh
  • 4,500
  • 1
  • 17
  • 28
0

to logout all users at certain time of day , you can use a HttpModule to check every coming request for the authentication cookie and then expire it if the request is received at the specified time.

check this question : How can I force a log out of all users for a website?

Community
  • 1
  • 1
mohsen dorparasti
  • 8,107
  • 7
  • 41
  • 61