Solved

Multiple login and membership provider

Posted on 2009-05-14
7
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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