views:

122

answers:

3

I have an application thats going to use Active Directory for Authentication. This will be used in mnay locaitons, so I want the user to be able to input their AD domain into a settings file. So, the first time they run this app, they won't be able to login, because they haven't entered the AD Domain name, so want I want to do, is check the web.config to see if there is an ADName value in there, if there isn't, forward them to the settings page, if there is, then they should be asked to authenticate and then forwarded to the index page. Is this possible?

In particualr what I need to know, is the best way to make it so the settings page does not require authetnication if the ADName value is empty, but does if it is not.

+1  A: 

Yes, add a key/value pair in your web.config. You key will be a static name say "ADNAME" and values will be csv format.

if the user who has logged in is entered in value redirect him to authetication thing.

you can access the value field by configurationmanager.appsettings["adname"].tostring()... Make sure you have imported systems.configuration.

I will advice you to store the mapping of user and adname in db instead.If storing in config file make sure you encrypt the file.

Samiksha
A: 

Can be a solution to store AD information in a Profile property, if you do not want to deal with a DB, there's around a text-file version of profile provider.

Andrea Celin
+1  A: 

It's absolutely possible. Using the Session_OnStart in the global.asax check if the user's info has been set using a unique id related to the AD Username. If not, redirect from there, if so, continue.

craigmoliver