Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Authenticate and redirect

Status
Not open for further replies.

grabrail

Technical User
Aug 15, 2001
269
GB
Hi, Can anybody help?

I am trying to get a basic Webpage for my default site in IIS.

This page needs to display Username and password input box.

I then want that input data to be checked against the users AD account and based on their name redirected to a url which is on a seperate site in IIS.

Cheers

J
 
Firstly - have you checked out Integrated Windows Authentication within IIS - if you use this authentication mode then you will remove the need to have an input box, because IIS will just check the user credentials against a list and approve or deny access to the website without the user having to do anything.

However, it looks like you want to do something a bit cleverer with your 'login' screen - maybe one group of users need to be sent to one page, another group need sending elsewhere.

So you will need to use the System.DirectoryServices namespace available within .NET Framework v1.1 + and Visual Studio 2005 (I'm assuming that you're using this to develop with) to query AD. You can pass in the username of the user (for example) and get back the surname and then write an if/else or case statement to do the redirect.

If you need any more help let me know and I'll post some code - I've done something pretty similar recently.
 
Mark

Cheers for this, the default website currently does have integrated authentication enabled but this can be removed.

The main site is on another port and exactly as you said we want the users to hit the default website, login and then be redirected to a url on the main site. Each user has a different page to redirect to.

The main site is a sharepoint site, and we are using the sharepoint designer to develop with, but if we need to we could prob use Visual Studio.

Any code you could provide would be helpful as we are amatuers at this end.

Thanks

Jade
 
1. Can you make the default page on your main website (something like run a script or assembly when you hit a submit button? I'm sure that you can achieve this just by modifying the .aspx page and adding a script to it but you'll need to check this out. If that's the case then you wouldn't really need to use Visual Studio.

2. However, you could write a custom web part that would do the job of taking user input and redirecting them (that would be my preference as I don't like monkeying around with the default page templates in SPP.

3. How are you going to store the redirect addresses for each user - database? inside an existing ad field that you're not using? extend the ad schema and add a new field? i think any of these would be preferable to storing the redirects in code as i originally suggested.

4. i'll put some information on my blog about searching ad and let you know when it's there. if you need it quicker than that then there are other articles on the web that I have used so just google.
 
Ok Ive managed to get some asp code working a treat, however now I have a simple issue of authentication

1stly I connect to
Prompts me for username and password which I enter

The code checks the username and redirects me to a url on another site (on the same server) but prompts me for username and password again, when I enter it lets me log in ok.

How do I get it to stop prompting me twice?

any ideas.

Cheers J
 
Sounds to me like the Integrated Windows Authentication is kicking in for both websites. I presume the prompts are system generated rather than asp.net controls that you have placed on the page.

So if you disable IWA for the second website that the user is being redirected to then you should stop getting the second prompt. However, you'll need to enable Anonymous Access instead otherwise no-one will be able to get in. Doing this assumes that your first website has dealt with all your security considerations - i.e. if the first website is working properly the user wouldn't be able to get to the second if they weren't authenticated.

You'll need to check how the authentication is propagating down through sites - in IIS you should have a structure similar to a top level site (called Default Web Site) under which sit all your websites and virtual directories. These will all inherit settings from the top level unless you tell them specifically to do otherwise (I think). Have a play and come back if you hit any more problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top