Follow Me On Twitter Facebook LinkedIn Flickr
Surprisingly I'm rather liking the Amazon elastic compute cloud. Running my first VM instance with my new pet Linux distro ubuntu 10.04 ... 2010-08-09
A software development and computer technology blog.

Archive for April 12th, 2005

VB.NET & Windows Authentication

I must remember that the default setup of IIS does not work well with windows authentication if you expect Request.ServerVariables(“LOGON_USER”) to actually return anything other than an empty string.

IIS is initially configured with anonymous access enabled and this must be disabled if using authentication mode=”Windows” in the web.config file.

Another was to retrieve a users domain and/or username, you can use the principal identity, this is provided by importing System.Threading and System.Security.Principle by using something like:

Using System.Threading
Using System.Security.Principle

WindowsPrinciple principal = (WindowsPrincipal)Thread.CurrentPrincipal
dim userAccount as string = Principal.Identity.Name