Solved

Multiple login and membership provider

Posted on 2009-05-14
7
262 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
Technology Partners: 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

632 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