Solved

Multiple login and membership provider

Posted on 2009-05-14
7
256 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

20 Experts available now in Live!

Get 1:1 Help Now