RadicalWacko March 24th, 2008
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?
RadicalWacko March 23rd, 2008
I’ve decided to start posting the solutions I find in irritating little problems that take me forever to find. Some of these will probably be obvious, but hopefully it might save someone’s time. My current problem was that I had a DotNetNuke module that was sitting in a AJAX Update Panel. I needed to set the focus to a particular control based upon a post back click on a radio button. The standard focus() method didn’t work and neither did the old fashioned RegisterClientScriptBlock stuff with a provided JavaScript function. Turns out there is an extremely easy way to do this which is to use the ScriptManager SetFocus method using the base Page for the control as shown below:
ScriptManager.GetCurrent(Me.Page).SetFocus(txtApplicationDate)
Hope that helps someone.