Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Different login page for each document...

Reply
Thread Tools

Different login page for each document...

 
 
=?Utf-8?B?U0I=?=
Guest
Posts: n/a
 
      01-19-2005
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
 
Reply With Quote
 
 
 
 
Stuart A Hill
Guest
Posts: n/a
 
      01-19-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U0I=?=
Guest
Posts: n/a
 
      01-19-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
=?Utf-8?B?U0I=?=
Guest
Posts: n/a
 
      01-20-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
David Jessee
Guest
Posts: n/a
 
      01-20-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hash .each and different action for each key Igor Nn Ruby 7 05-28-2011 12:33 PM
login page stays on login page Shannon ASP .Net 2 01-09-2008 10:51 PM
News login different from mail login William W. Plummer Firefox 21 04-08-2005 05:37 AM
Datagrid with different # of items on each page... Richard ASP .Net 0 09-01-2004 06:50 PM
ASP page to show different schedule on each day Matthew Louden ASP .Net 2 11-01-2003 05:14 AM



Advertisments