what's differences between “forms timeout”, “membership userIsOnlineTimeWindow” and “sessionState timeout”

后端 未结 2 1090
栀梦
栀梦 2021-02-13 15:55

What is the difference between these lines of code:







        
2条回答
  •  时光说笑
    2021-02-13 16:52

    Note the following behavior:

    You set Session timeout = 10 minutes and Forms Authentication timeout = 8 minutes.

    The user logs into your site using Forms Authentication.

    Both the Session "clock" and Forms Authentication "clock" start running.

    Suppose that you keep some info needed for the site's operation in the Session(For example, Session["userData"] = userData;).

    The user is idle for 9 minutes.

    At 8 minutes the session times out and the user's data is cleared.

    At 9 minutes when the user tries to perform some activity on the site, you naively reference the Session["userData"] to get his info. Since it is null he will get error 500 for a null reference.

    Conclusion: Keep the forms authentication timeout shorter than the session timeout.

提交回复
热议问题