Here is my web config file
<authentication mode="Forms">
<forms loginUrl="~/Auth/signin.aspx" timeout="1" slidingExpiration="true" />
</authentication>
I tried following way
Configuration conn = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
AuthenticationSection section = (AuthenticationSection)conn.SectionGroups.Get("system.web").Sections.Get("authentication");
FormsAuthenticationConfiguration currentForms = section.Forms;
var tim = currentForms.Timeout;
currentForms.Timeout = new TimeSpan(0, 2, 0);
int timeout = currentForms.Timeout.Minutes;
But it doesn't change in web config file. Can you please help me to Change authentication Timeout value in C# code.