GateKiller GateKiller - 2 months ago 21
ASP.NET (C#) Question

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?

Answer

Try Context.User.Identity.AuthenticationType

Go for PB's answer folks