.NET访问窗体身份验证"超时"在code值 [英] .net Access Forms authentication "timeout" value in code

查看:111
本文介绍了.NET访问窗体身份验证"超时"在code值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加注销过期警报,我的应用程序,并想从我的code访问我的web.config窗体身份验证超时值。什么办法能做到这一点?

I'm adding a logout expiration alert to my application and would like to access my web.config forms authentication "timeout" value from my code. Any way i could do this?

推荐答案

我想你可以从FormsAuthentication静态类的方法,这将是比做得最好通过直接读取web.config中,你可能会继承身份验证阅读设置从更高级别的Web.config。

I think you can read it from the FormsAuthentication static class methods, which would be better than doing it by reading the web.config directly as you may be inheriting authentication settings from a higher level web.config.

var authTicket = new FormsAuthenticationTicket(user.EmailAddress, true, (int)FormsAuthentication.Timeout.TotalMinutes);

这篇关于.NET访问窗体身份验证"超时"在code值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆