Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 24th, 2008, 01:48 PM
Authorized User
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default forms authentication with two login pages

Got another question for someone with more experience. I have a web app that has a subfolder (/subfolderA) requiring a login page with forms authentication and roles. Goes against a custom sql2005 database for authentication and that's working fine.

But, I have another subfolder (/subfolderB) that requires its own login that goes against a different sql2005 database for authentication - one having nothing to do with the other.

When I tried to put a separate webconfig file in /subfolderB, it required that the subfolder be a separate app. That meant that references to MasterPages, images, css files, custom-menu code, etc., be in /subfolderB. That seems terribly wasteful and not a really good design option...

Does anyone know a way in the original webconfig to have two separate login page references, or is there a better way to do this? It's really not an option to have one login since the two departments insist on having their own wording on the login page.

Could I do something like look at the referring url and if it contains /subfolderB, redirect to the other login page? Or, what would you (anyone) suggest in a situation like this.

Many thanks.
Old March 24th, 2008, 11:01 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Your approach may be the best.

No, you can not have two login pages for a single application. That is configured at the application level. If you can somehow identify the users by either a start page (maybe a link to your app from an internal website), IP address (specific or a range if your have a segmented network) or some other means, then you could determine what login page they will see.

Also, you could use the same login page for the functionality by just change the text the user sees as needed.

If you expect people to bookmark the page, you might consider dropping a cookie that identifies them for future visits. You could set a precedence that there always need to be a cookie identifying the user's department in order for the login page to show the login. If the login page doesn't find a cookie, it could first prompt the user to select their department. Then your set the cookie and show the login. Department specific landing pages could do this automatically so they needn't be prompted.

Old March 25th, 2008, 08:09 AM
Authorized User
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Once again, thank you. It gives me a clearer understanding of what's possible. I'll consider your suggestions and go from here.

Similar Threads
Thread Thread Starter Forum Replies Last Post
How windows NET authentication done in ASP pages lakshmy_raj Classic ASP Basics 1 October 20th, 2004 02:28 AM
Form authentication & multiple login pages duydp ASP.NET 1.0 and 1.1 Professional 2 September 14th, 2004 12:18 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.