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

How can you retreive the authentication mode programatically?

 Posted by Ddd on 2/22/2011 | Category: ASP.NET Interview questions | Views: 3139 | Points: 40
Answer:

To retreive the authentication mode, write this code snippet in Page_Load()


AuthenticationSection a=(AuthenticationSection) WebConfigurationManager.GetSection("system.web/authentication");

Response.Write(a.Mode.ToString());


Note:

You must include System.Web.Configuration namespace for this code to work,


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response