We currently have a development server set up which we are trying to test some Windows authentication ASP.NET code on.

We have turned on Windows Authentication in IIS7 on Windows Server 2008 R2 fine, and it asks the user for a username and password as excepted, but the problem is it doesn't appear to accept any credentials. This code for example...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.Title = "Home page for " + User.Identity.Name
End Sub

...always returns an empty string.

One theory we have is that we dont have Active Directory installed as of yet, we are just testing this by logging on via the machine name not a domain.

Is this type of authentication only applicatable to domains (if so we can probably install Active Directory and some test accounts) - or is it possible to get the user identity when logging in using the machine name?

Ideally we would like to be able to test this on our local machines (Windows 7 Pro) using our own accounts (again these aren't on a domain) and IIS but this has the same issue as our dev server.



Nope Auth is not only for domain accounts!

Authentication type is defined on web.config or on IIS. If it is on IIS 7 try checking if the anonymous authentication isn't enabled. And do check if your app doesn't say on web.config

<authentication mode="none" />

That would cause an empty string on user name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.