Question

(500pts)Multiple loginurl for forms auth in asp.net?

Asked by: ianinspain

hi there,

I had a few problems with forms authentication a while ago but got some help in fixing it. Now I have a question with regards to multiple loginurl's, i did ask this in my previous question but it wasn't really fair as it is separate to that question... here we go................

My App (running on same domain name) has 2 entrance security points i.e.

Admin (which is the Security Main Admin for system administrators)
Useradmin (which is like a control panel for individual users)

Currently I have one main web.config in the root which has the Forms AUthentication enabled etc
and then I have another web.config in the Admin directory which is where I was testing. I will put it below as it isn't large the one in the admin


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <system.web>
            <authorization>
                  <deny users="?" />
            </authorization>
      </system.web>
</configuration>

It works great! But the problem is that in the Admin directory I want anyone trying to use a page there to be presented with /Admin/Login.aspx and it does as the loginurl etc is in the main web.config in the root

But if somebody goes to a page under /UserAdmin then I want them to be presented with a completely different loginurl i.e. /UserAdmin/login.aspx

It does'nt, it uses the loginurl of Admin..... My reason for wanting this is because I need a different login screen and the logic behind it is different too.

Previously I did try putting the loginurl in the web.config in the Admin dir etc but this was the reason of my last problem.. We discovered i needed a cut down version of the web.config that goes in the other directories as per above (see above web.config)

Can anybody suggest a work around or something? Or indeed can it be done?

I am placing below the web.config of the root, its larger than the one above... Just for information.

Thanks in advance

Ian

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>

    <!--  DYNAMIC DEBUG COMPILATION
          Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to
          false will improve runtime performance of this application.
          Set compilation debug="true" to insert debugging symbols (.pdb information)
          into the compiled page. Because this creates a larger file that executes
          more slowly, you should set this value to true only when debugging and to
          false at all other times. For more information, refer to the documentation about
          debugging ASP.NET files.
    -->
    <compilation
         defaultLanguage="c#"
         debug="true"
    />

    <!--  CUSTOM ERROR MESSAGES
          Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
          Add <error> tags for each of the errors you want to handle.

          "On" Always display custom (friendly) messages.
          "Off" Always display detailed ASP.NET error information.
          "RemoteOnly" Display custom (friendly) messages only to users not running
           on the local Web server. This setting is recommended for security purposes, so
           that you do not display application detail information to remote clients.
    -->
    <customErrors
    mode="Off"
    />

    <!--  AUTHENTICATION
          This section sets the authentication policies of the application. Possible modes are "Windows",
          "Forms", "Passport" and "None"

          "None" No authentication is performed.
          "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
           its settings for the application. Anonymous access must be disabled in IIS.
          "Forms" You provide a custom form (Web page) for users to enter their credentials, and then
           you authenticate them in your application. A user credential token is stored in a cookie.
          "Passport" Authentication is performed via a centralized authentication service provided
           by Microsoft that offers a single logon and core profile services for member sites.
    -->
    <authentication mode="Forms">
                <forms name=".ASPXAUTH" loginUrl="Admin/Login.aspx" />
    </authentication>

      <!--  AUTHORIZATION
          This section sets the authorization policies of the application. You can allow or deny access
          to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
          (unauthenticated) users.
    -->

    <authorization>
        <allow users="*" /> <!-- Allow all users -->
            <!--  <allow     users="[comma separated list of users]"
                             roles="[comma separated list of roles]"/>
                  <deny      users="[comma separated list of users]"
                             roles="[comma separated list of roles]"/>
            -->
    </authorization>

    <!--  APPLICATION-LEVEL TRACE LOGGING
          Application-level tracing enables trace log output for every page within an application.
          Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
          trace information will be displayed at the bottom of each page.  Otherwise, you can view the
          application trace log by browsing the "trace.axd" page from your web application
          root.
    -->
    <trace
        enabled="false"
        requestLimit="10"
        pageOutput="false"
        traceMode="SortByTime"
            localOnly="true"
    />

    <!--  SESSION STATE SETTINGS
          By default ASP.NET uses cookies to identify which requests belong to a particular session.
          If cookies are not available, a session can be tracked by adding a session identifier to the URL.
          To disable cookies, set sessionState cookieless="true".
    -->
    <sessionState
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
            cookieless="false"
            timeout="20"
    />

    <!--  GLOBALIZATION
          This section sets the globalization settings of the application.
    -->
    <globalization
            requestEncoding="utf-8"
            responseEncoding="utf-8"
   />
   
 </system.web>

</configuration>

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-01-28 at 03:18:37ID21292322
Tags

multiple

,

loginurl

,

forms

,

asp.net

,

.net

Topic

Programming for ASP.NET

Participating Experts
4
Points
500
Comments
10

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. ASP.NET Forms authentication
    I'm trying to use mode="Forms" authentication in my ASP.net application. Here is my web.config code: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation defaultLanguage="vb&...
  2. Securing a specific page [ASP.NET]
    I do face a little problem and I do need an immediate help!! The following code is what I do have under the Web.config and it does secure the entire web application but what I need is only securing a specific page (add_me.aspx) How can the following script be adjusted so th...
  3. XML and ASP.NET
    Say I am given the following XML as a response from a WebRequest. <PlaceWareConfCenter authUser="admin_apiuser" authPassword="frabjous"> <CreateTicketRequest duration="300"> <GeneralLoginContext userID="dori"/&...
  4. ASP.Net Does the Dll and pdb file are necessary
    Hi.. I just want to know that code behind require in any asp page need to be specifiyically on the DLL and pdb file or we can use some other method. I am new to ASP.Net and use it using VS.Net 2002 but Now i doesn't need to use the VS.Net (As my new office doesn't have ...
  5. Forms Auth - Signoff User
    Hi all. Ok I am new to forms authentication and I am trying to pull this all together. Right now I have a login page where if the user authenticates against a SQL Database then I move on and I am setting up a Forms Auth ticket etc. I then have pages where I want to check c...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: djhexPosted on 2005-01-28 at 04:43:24ID: 13162563

You can only have one  by application
<authentication mode="Forms">
    <forms name="MDLPortal.Web"
        loginUrl="Security/Login.aspx"
        timeout="30"
        path="/"
        protection="All">
    </forms>


I suggest you to use some login on behind. You can make in  the same login.aspx  use 2 panels  with different login screens and depending on session variables thath you fill before on your programming logic you can set the visible property to true or false.

 

by: raterusPosted on 2005-01-28 at 05:49:05ID: 13162940

like dj said, only one login per application, but that doesn't mean you can't create an application solely for your other login page, and then move them back to your main app...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconformsauthenticationacrossapplications.asp

 

by: sriggummaPosted on 2005-01-28 at 06:34:49ID: 13163357

Yes. You can have only one Login form per application.

But in case you have two different folders for the two login URLs you are using, then you may configure the same in Web.config. In this case you can place two <system.web> sections in one Web.Config file and hence two different settings can be defined.

 

by: sriggummaPosted on 2005-01-28 at 06:43:06ID: 13163476

Web.Config can be set like below:
Like this you can specify different settings for Admin folder alone.

----->
<configuration>
<system.web>
      <authorization>
            .................
      </authorization>
</system.web>
<!--- Above is the existing section in Web.Config --->
<!--- Below is the new section in Web.Config --->
<location path="Admin">
<system.web>
      <authorization>
            .................
      </authorization>
</system.web>
</location>



Hope this gives an idea.

 

by: raterusPosted on 2005-01-28 at 06:45:29ID: 13163500

Also, nothing would stop you from creating an unprotected folder for an admin login page.  Web config won't redirect to you this page automatically though when there is a failed attempt at accessing a page.  But you could always link to it from the main login page.

 

by: sriggummaPosted on 2005-01-28 at 06:57:36ID: 13163645

ianinspain,
Here are some URLs for reference:
http://support.microsoft.com/kb/815174
http://www.dotnetjunkies.com/quickstart/aspplus/doc/configformat.aspx


raterus ,
Is there any  problem to use this approach?

 

by: raterusPosted on 2005-01-28 at 07:06:45ID: 13163738

The only problem I see is that the secondary login page wouldn't be the "accepted" login page for the application, so even if an admin was browing their pages, and somehow was deauthenticated, they would be booted back to the user login page, and not the one they entered through.

Personally though, I wouldn't mess with two login pages, there is no need that I see.  Your login page should know if the user is an admin or not, and redirect them accordingly, either to the admin pages, or the user pages.

 

by: sriggummaPosted on 2005-01-28 at 07:10:35ID: 13163772

raterus ,
Thank you.

 

by: deepaklakhaniPosted on 2005-01-28 at 07:37:33ID: 13164080

just want to be updated on this one..thx

 

by: ianinspainPosted on 2005-02-06 at 04:10:58ID: 13238171

Sorry guys for the delay, my computer that had my internet connection on blew up!!! so moved connection over until i get it sorted.

Everyone has give some really good info, i feel more confident now with regards to this AND thinking my strategy again, i could just use 1 login page and stored Password and users in same DB table and create like a permissions table which maybe better.

Thanks again.. splitting points now and once again sorry for the delay...

Ian

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...