views:

131

answers:

2

I have an ASP.NET application where only users authenticated by Windows (i.e. logged on user) have access to most pages. Now, my client wants to be able to 'log on' through this app, with a custom login dialogue/page.

Is Authentication the way to achieve this, and how do I go about it?

+1  A: 

You can create an interface to accept your user login info and to create a new crdential with this:

NetworkCredential credentials = new NetworkCredential("username", "password");

And use this credential to access your secured resource.

Rubens Farias
+2  A: 

What's wrong with using Forms Authentication?

You can set the the impersonate attribute in the identity element in your web.config to true if you need impersonation as well, but from what you've mentioned, it doesn't sound like you need impersonation at all.

Wim Hollebrandse
The user wants Windows auth, to use existing AD based logins. I could probably use Forms auth, but manually use Windows auth behind the scenes, but that is ugly.
ProfK
Why is that ugly? Simply use the ActiveDirectoryMembership provider and you're done. Piece of cake. Nothing manual about it, especially not when using the Login control etc. in combination with the standard AD membership provider as mentioned.
Wim Hollebrandse