By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Different login page for each document...

P: n/a
SB
Hi
I'm trying to get forms-based authentication to authenticate different users
for differet pages, like this:

<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
<location path="Admin" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage2.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

But here I get this error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

Many thanks for your help
Simon
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Simon,

This error would normally indicate that the Virtual Directory for your web
is not set up properly.

1. Go to Start - Settings - Control Panel - Administrative Tools - Internet
Information Services
2. Expand the nodes to see Default Web Site

Do you have node for your web site? If so check the properties or if you are
not sure about this delete it. If it is not there do the following:

3. Right-click the Default Web Site node to bring up the menu and select
New - Virtual Directory
4. Create a new virtual directory and the location is the folder location of
your files..

Try it again. If this isn't the problem and you still get the same error,
I'll look in more detail at your web.config entries.

Regards,

Stuart
MCSD, MCT
"SB" <SB@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi
I'm trying to get forms-based authentication to authenticate different
users
for differet pages, like this:

<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
<location path="Admin" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage2.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

But here I get this error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

Many thanks for your help
Simon

Nov 19 '05 #2

P: n/a
SB
Hi Stuart

Thank you for your swift answer. The issue is I would like to dedicate an
seperate login page to each page. I can get it to work if I only use one
login page outside the <location> element.

What works:
<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="BØ"/>
<allow users="SB"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<system.web>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="Login.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</configuration>

What doesn't work:
<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

As you can see when the authentication is placed within the <location>
element, everything goes nuts :).
Best regards
Simon
"Stuart A Hill" wrote:
Hi Simon,

This error would normally indicate that the Virtual Directory for your web
is not set up properly.

1. Go to Start - Settings - Control Panel - Administrative Tools - Internet
Information Services
2. Expand the nodes to see Default Web Site

Do you have node for your web site? If so check the properties or if you are
not sure about this delete it. If it is not there do the following:

3. Right-click the Default Web Site node to bring up the menu and select
New - Virtual Directory
4. Create a new virtual directory and the location is the folder location of
your files..

Try it again. If this isn't the problem and you still get the same error,
I'll look in more detail at your web.config entries.

Regards,

Stuart
MCSD, MCT
"SB" <SB@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi
I'm trying to get forms-based authentication to authenticate different
users
for differet pages, like this:

<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
<location path="Admin" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage2.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

But here I get this error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

Many thanks for your help
Simon


Nov 19 '05 #3

P: n/a
can you take the approach of a single logon page and in the login, set the
users' Roles? then verify for different roles within the forms? instead of
adding users to each form's permission, you'd ass them to the groups.
Effectively its the mase hting, and its supported by the framework
"SB" <SB@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi
I'm trying to get forms-based authentication to authenticate different users for differet pages, like this:

<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
<location path="Admin" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage2.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

But here I get this error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

Many thanks for your help
Simon

Nov 19 '05 #4

P: n/a
SB
I would do that by writing the different usergroups in the config file

<allow users="Admins"/>
<allow users="Users"/>

And the when they log in give then the rights

If Admin logs in Then
System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("Admins",
False)
ElseIF User logs in Then
System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("Users",
False)
End If
/Simon
"David Jessee" wrote:
can you take the approach of a single logon page and in the login, set the
users' Roles? then verify for different roles within the forms? instead of
adding users to each form's permission, you'd ass them to the groups.
Effectively its the mase hting, and its supported by the framework
"SB" <SB@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi
I'm trying to get forms-based authentication to authenticate different

users
for differet pages, like this:

<configuration>
<location path="Member" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<allow users="User"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage1.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
<location path="Admin" allowOverride="true">
<system.web>
<authorization>
<!-- allow tags must be first -->
<allow users="Admin"/>
<deny users="*"/>
</authorization>
<authentication mode="Forms">
<forms
name="MyWebsiteCookieName"
loginUrl="LoginPage2.aspx"
protection="All"
timeout="180"
/>
</authentication>
</system.web>
</location>
</configuration>

But here I get this error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

Many thanks for your help
Simon


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.