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?
This Code will give you timeout
in minutes from AuthenticationSection
section present in your current project's Web.Config file,
Configuration conn = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
AuthenticationSection section = (AuthenticationSection)conn.SectionGroups.Get("system.web").Sections.Get("authentication");
FormsAuthenticationConfiguration currentForms = section.Forms;
int timeout = currentForms.Timeout.Minutes;
txtAppSessionTimeout.Text = timeout.ToString();
Please mark it as correct if you found this answer is correct