>Hi,
>
>I want to determine the Authentication mode set in the web.config of an ASP.NET application.
>
>I found this article:
>
https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.authenticationsection.mode?redirectedfrom=MSDN&view=netframework-4.8#System_Web_Configuration_AuthenticationSection_Mode>
>But when I add the following code to my page:
>
>// Get the current Mode property.
>AuthenticationMode currentMode = authenticationSection.Mode;
>
>
>the line authenticationSection has a squiggly red underling and the error message:
>"The name 'authenticationSection' does not exist in the current contect"
>
>Any suggestion of what I am missing?
>
>TIA
authenticationSection seems to be an object of the type AuthenticationSection and that object has not been created in this code.
This might help:
// Get the section.
AuthenticationSection authenticationSection =
(AuthenticationSection)configuration.GetSection(
"system.web/authentication");
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.