How to set asp.net authenticated properties

前端 未结 3 997
野的像风
野的像风 2021-01-01 08:02

I have the following settings in my web.config file. It basically restricts access to a page if the user is not logged in. If I don\'t want to use the asp login controls or

3条回答
  •  天涯浪人
    2021-01-01 09:00

        // formsAuth does not expose timeout!? have to hack around the
        // spoiled parts and keep moving..
        HttpCookie fooCookie = FormsAuthentication.GetAuthCookie("foo", true);
        int formsTimeout = Convert.ToInt32((fooCookie.Expires - DateTime.Now).TotalMinutes);
    

    Forms Authentication does expose timeout as of .Net 4.0 FormsAuthentication.Timeout.TotalMinutes

提交回复
热议问题