I recently had a task in one of my current projects that required me to extract the authentication mode of the current solution’s web.config file. The only was I figured out how to do it was by parsing the XML of the file by hand as shown below (Yeah, I know, it’s VB.NET. I do what the client wants.):
Dim config As New System.Xml.XmlDocument() config.Load(Server.MapPath("Web.config")) Dim authMode As System.Xml.XmlNode = config.SelectSingleNode("/configuration/system.web/authentication/@mode") Return authMode.Value
While that works just fine, it seems a little primitive and I figured Microsoft would have introduced a library to get that kind of data. Anyone know of any?