Search code examples
c#asp.netauthenticationweb-config

Detecting Web.Config Authentication Mode


Say I have the following web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authentication mode="Windows"></authentication>
    </system.web>
</configuration>

Using ASP.NET C#, how can I detect the Mode value of the Authentication tag?


Solution

  • Try Context.User.Identity.AuthenticationType

    Go for PB's answer folks