Authenticating domain users

G

Guest

Hi,

I am writing a program that will require a user to log in using their domain
account which will then take the information to a SQL Server database stored
on the server and try to log in using that information.

Several questions:

1) What class should I use once I have the username / password to
authenticate the account on the domain?
2) Is there any way for me to use Windows' authentication dialog? This is
the dialog that always comes up when you try to access something that you
need to login to. IE uses it, as well as Windows Explorer. I'd much rather
use this dialog somehow than create one of my own.
3) Slightly unrelated question... Lets say the user authenticated correctly
against the domain, and now I want to access the database. I currently have
it set so that I have database roles assigned to user types on the domain.
So, when I login to the database using SqlConnection, should the username and
password be set to the the user's domain username and password?

Thanks for all help!

Yaron
 
D

D0tN3t C0d3r

Hi Yaron,

What kind of application is this? Is it a Web Application or a Windows
Forms Application? The reason being, there are different methods for
network authentication based upon the model used. I will provide links
to both.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod16.asp
(Using Forms Authentication)

http://www.codeproject.com/csharp/getusername.asp (Windows Forms)

http://www.dnzone.com/ShowDetail.asp?NewsId=504

http://msdn.microsoft.com/library/d...us/cpguide/html/cpconaspnetauthentication.asp

For your second question, what you need to do is in your connection
string for the SqlConnection object, you need something along these
lines: "server=(local);database=Northwind;Trusted_Connection=yes". You
can also dynamically build the connection string using:
"server=(local);database=Northwind;UID=<user
name>;PWD=<pass>;Trusted_Connection=yes;"

HTH,
~d
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top