Solved

Multiple login and membership provider

Posted on 2009-05-14
7
257 Views
Last Modified: 2012-05-07
Hi all

Let say if I have 2 folders:

/admin
/public

Each folder I have to put the login.aspx ... now how do I control that if someone accessing through /admin then every page that located under admin folder will be redirected to /admin/login.aspx if the user trying to bypass the login?

Or similar thing if someone through /public then every page that located under public folder will be redirected to /public/login.aspx if the user trying to bypass the login?

At the moment I put below which works ok If you are accessing through /admin folder.

Thanks
<authentication mode="Forms">

      <forms loginUrl="~/Admin/Login.aspx" defaultUrl="~/Admin/default.aspx" />

    </authentication>

    <authorization>

      <deny users="?"/>

      <allow users="*"/>

    </authorization>

Open in new window

0
Comment
Question by:dewacorp_alliances
  • 3
  • 2
7 Comments
 
LVL 9

Expert Comment

by:tetorvik
ID: 24392451
You can have a folder specifig web.config files where you can override the settings in a higher-level Web.config file.
This provides a way have different configurations in different folders in a single ASP.NET application.

Hope this helps!
0
 

Author Comment

by:dewacorp_alliances
ID: 24392479
Hi tetorvik

Ok you need to have 2 virtual directories then ... one is for Admin and the other one is Public? In VS 2005 how do I setup this things? Do I need to create 2 web applications?

Thanks
0
 
LVL 9

Expert Comment

by:tetorvik
ID: 24392571
You can simply add Public and Admin folders into your project. In the folders you should have the pages specifig to admin/public and the specifig configuration file (web.config) for both folders.

So only one application is required.

 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:DreamsTech
ID: 24393502
I would say ,the guidelines says u shud have only one login Page ,and u need to set up the roles of the user based on which he can browse to only those pages to which he has access.


<forms loginUrl="~/LoginPage/Login.aspx" defaultUrl="~/Pages/default.aspx" />

Open in new window

0
 

Author Comment

by:dewacorp_alliances
ID: 24400714
Hi Tetorvik

I did try your suggesting by using 2 folder on the same project and put each web.config on those folders but an eror comes out and also crate another project on for admin and one for public ... and it the same error:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.      
0
 
LVL 9

Accepted Solution

by:
tetorvik earned 250 total points
ID: 24401261
You were right. it seems that there are certain properties in web.config which cannot be set to override the parent web.config (such as authenitication and session sections) unless the sub-directory is also configured as an application. I am sorry I wasn't aware of this limitation and had only been using multiple web.configs in other context.

Sorry for the trouble caused!

http://geekswithblogs.net/ranganh/archive/2005/04/25/37609.aspx


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now