Session timeout (Slideexpiration) is affected by WebSync

25 views
Skip to first unread message

rodrigo nunes

unread,
Mar 22, 2013, 2:40:48 PM3/22/13
to web...@googlegroups.com
Hello, 

Is there any way to become idle client and fire the Session_End event as it normally works?

thanks

Ben Swayne

unread,
Mar 22, 2013, 3:05:00 PM3/22/13
to web...@googlegroups.com
Hi Rodrigo,

You can call `.Disconnect()` and the client will disconnect which will prevent any further http requests to your application.

As for the Session_End event, it can take some time to fire as it is not under out control. This is affected by your Session configuration in your web.config.

If you need more immediate notification of a client disconnect, you can alternatively use an AfterDisconnect WebSyncEvent which will fire immediately when you call 'Disconnect()' or will also fire after a client is idled out.


Just to clarify your use case, are you interested in having the client disconnect when someone leaves your website open for a very long time (like 24 hours)? Is this the problem you are trying to address specifically?

Best Regards,

Ben Swayne
Frozen Mountain Software
888-379-6686 (Extension 
103)
www.frozenmountain.com



--
You received this message because you are subscribed to the Google Groups "WebSync" group.
To unsubscribe from this group and stop receiving emails from it, send an email to websync+u...@googlegroups.com.
To post to this group, send email to web...@googlegroups.com.
Visit this group at http://groups.google.com/group/websync?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/websync/-/O0H8rl3WlzoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jerod Venema

unread,
Mar 22, 2013, 3:28:40 PM3/22/13
to web...@googlegroups.com
You can also have your session expire by making all WebSync connections happen on a different domain, and then simply ensuring your session cookies aren't tied to that domain.
--
Jerod Venema
Frozen Mountain Software
919-300-5141 (United States)
604-227-2453 (Canada)
888-379-6686 (Extension 101)

rodrigo nunes

unread,
Mar 22, 2013, 3:51:46 PM3/22/13
to web...@googlegroups.com
Exactly,I needed that after a long inactive, the client stop  and usually occur Session_End.


 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
           
         
            try
            {
                MembershipUser mu = Membership.GetUser(Login1.UserName);
               

                if (mu.IsApproved)
                {
                    if (Membership.ValidateUser(Login1.UserName, Login1.Password))
                    {
                      Guid gu = Guid.Parse(Membership.GetUser(Login1.UserName).ProviderUserKey.ToString());
                        e.Authenticated = true;
                        Session["guidID"] = gu.ToString();
                       Record fd = new Record("friends");
                      WebSyncServer.Bind(gu, fd);
                      
   MemoryCache cache = MemoryCache.Default;
.................................................
                  }
                }
              }

      protected void Session_End(object sender, EventArgs e)
        {
              WebSyncServer.Unbind ...
          // End Caches.....
            Debug.WriteLine("closed session");
        }

Thanks.

rodrigo nunes

unread,
Mar 22, 2013, 4:06:35 PM3/22/13
to web...@googlegroups.com
hello,
I meant that the Session_End event (timeouts) usually works without WebSync
thanks.


On Friday, March 22, 2013 3:40:48 PM UTC-3, rodrigo nunes wrote:

rodrigo nunes

unread,
Mar 22, 2013, 4:07:52 PM3/22/13
to web...@googlegroups.com
hello,
I meant that the Session_End event (timeouts) usually works without WebSync
thanks.

On Friday, March 22, 2013 3:40:48 PM UTC-3, rodrigo nunes wrote:
Message has been deleted

rodrigo nunes

unread,
Mar 22, 2013, 4:41:49 PM3/22/13
to web...@googlegroups.com
Jerod Venema ,But this way I would work in conjunction with the requests of the WebSync?

The ideal world would be a Setting for if the client does nothing in a given period. Stay idle and it no longer affects the session end

thanks

On Friday, March 22, 2013 3:40:48 PM UTC-3, rodrigo nunes wrote:

Jerod Venema

unread,
Mar 22, 2013, 4:57:34 PM3/22/13
to web...@googlegroups.com
The difficulty is the definition of "does nothing" or "idle". With WebSync, there's *always* a connection, so the client is never idle. That's the issue.

What you need to do is separate WebSync from the rest of your application. Assuming you're not using session in WebSync (which is always a best practice) all you need to do is make sure your cookies are left alone by WebSync requests. You can do this by:

1) different domains (as mentioned in my previous email) or
2) using the "path" parameter of the cookie. For example, you can set the path to "/a/" (and make sure your application resides under "/a"), and then ensure that all WebSync requests go through the root /request.ashx.

wwwroot
  /a/myapp.aspx [session cookie is set for this folder and below only]
  /request.ashx [session cookie does not apply

In this way, you've made the session distinct from WebSync. You can't use session variables in WebSync anymore (which as mentioned is probably a good thing), but your session will now idle out as you expect.

Hope that helps.

--
You received this message because you are subscribed to the Google Groups "WebSync" group.
To unsubscribe from this group and stop receiving emails from it, send an email to websync+u...@googlegroups.com.
To post to this group, send email to web...@googlegroups.com.
Visit this group at http://groups.google.com/group/websync?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/websync/-/3gpS24CfvoYJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

rodrigo nunes

unread,
Mar 22, 2013, 5:44:40 PM3/22/13
to web...@googlegroups.com
Thanks.


On Friday, March 22, 2013 3:40:48 PM UTC-3, rodrigo nunes wrote:
Reply all
Reply to author
Forward
0 new messages