473,785 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master pages and Forms Authorization

I'd like to use a master page for (nearly) every page in my ASP.NET 2.0
website.

I also have some webpages that I'd like to protect by using forms
authorization.

I have a page that requires authenticated users, so I've dropped it in a
virtual application with a web.config that denies access to anonymous users
like so:

<authorizatio n>
<allow users="*" />
<deny users="?" />
</authorization>

This page also uses the global master page which resides at the root level.

Trying to load this page results in an exception:

The virtual path '/MasterPage.mast er' maps to another application, which is
not allowed.

Is this really by design? It's a real bummer when two great new features
don't play well with each other. Am I missing something here? Can I
utilize forms authorization without putting my protected pages in a virtual
application? Alternatively, is there a way to use a single master page in
several virtual applications?

thanks

-ivan.
Mar 26 '06 #1
1 2145
On Sat, 25 Mar 2006 22:15:54 -0600, gilly3 wrote:
I'd like to use a master page for (nearly) every page in my ASP.NET 2.0
website.
Ok.
I also have some webpages that I'd like to protect by using forms
authorization.
Ok.
I have a page that requires authenticated users, so I've dropped it in a
virtual application with a web.config that denies access to anonymous users
like so:
Why? You don't have to specify a new web application to protect just a few
pages. You can specificy protection of individual pages in the location
section of the web.config.
<authorizatio n>
<allow users="*" />
<deny users="?" />
</authorization>


As a side note, this won't work. This will allow all users, all the time.
You want to reverse the order of those, since asp will take the first valid
condition and apply it, in this case allow all users. Reverse it so that
unauthenticated users are denied first.
Mar 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2515
by: Eric | last post by:
I am trying to build an app where the stuff in the root directory is open to all, but anything under the Restricted directory requires you to login and I want to use Forms to do it. I'm having trouble getting the web.config to work properly. First I tried to have a second web.config in the sub directory with authentication and authorization set to forms, but it blew up. Next, I tried to modify the root web.config in the following manner...
2
1392
by: Shimon Sim | last post by:
I am creating application that is mostly is used by registered user. I am using Form security to let user in. I also need to create registration for users. This of cause has to be accessible to everyone. Can I do everything in one ASP.NET application or I have to create two applications for each task? Thanks, Shimon.
4
2656
by: MR. UNDERHILL | last post by:
I want to use forms authentication on my website. Looking at the documentation, I create a sample site for testing. One of my requirements is to ensure that SOME pages required an authenticated user and some others, like the home page is not required. I specified the <deny users="?" /> on the web.config, but this is causing ALL pages require the authentication. How can I mix both, without loosing the web.config setup? I know that I can...
2
1853
by: Oldman | last post by:
I am using ASP .NET 2.0, VS2005 Professional RTM. I added a master page to my web application and made my default page refer to it. I then proceeded to theme some elements in the master page. Everything worked great. When I then went to my login page and had it refer to the master page as well things started going wrong. I attempt to run my application and get directed to the login page. The login page is missing all the "themeing"...
3
4698
by: Adam J Knight | last post by:
Hi all, I have an app that mostly requires authentication. However there are a couple of pages that don't require authentication.. What do i need in my web.config, to specify these pages don't require authentication.. thus the user is not redirected to my default login url..when they ('pages') are requested.
17
3161
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content pages? Kinda sorta a critical point no? Am I missing something? Rob. P.S. the day I find a book that actually is useful rather than just a
2
3750
by: Rob R. Ainscough | last post by:
I'm using forms authentication along with Master pages -- my authenticated forms reside is a sub-dir (Secure) below the web site root dir. The problem is that any graphics placed on the Master page do NOT appear in any of the web forms located in my Secure dir, however, any forms off the root of my web app will display the master page with the graphics. Is there some trick to get master pages to work with forms authentication of forms...
3
1781
by: =?Utf-8?B?TWF4IFR1cmF2YW5p?= | last post by:
Hi, Is there any way I can cause a login page to appear, using Forms authentication of course, when access a particular page only. In my case, I am building a site for rental properties. There are a group of files ( HTML, ASPX files ) that are freely publicly accessable. There are certain pages however that my client will use to update their listings and images. I would like those pages ONLY to be redirected to the login page but NOT the...
1
1120
by: mshiva | last post by:
hi friends i want to open a login page first even for accessing any other pages in the application. my code in web.config: <authentication mode="Forms"> <forms loginUrl="~/Pages/login.aspx" defaultUrl ="~/Pages/default2.aspx" protection ="Validation" timeout="30"/> </authentication> <authorization> <deny users ="?"/>
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.