473,473 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to redirect

All,

I am using Form Authentication with Roles.
E.G. PageA.aspx is permitted for Role "Admin",
and PageB.aspx is permitted for Role "Basic".

When a user of "Basic" role try to access an "Admin" page directly,
Login From shown and he enters his username and password.
He is then AUTHENTICATED but stays on the Login form because
he is not permitted to view the "Admin" pages.

My question is: Is there a way to redirect the user to a "Not-permitted-page" ?

Thanks

John
Nov 18 '05 #1
3 1541
Hi John,

Can you add a section to the web.config to exempt the notpermitted.aspx page
from the authentication?

<location path="notpermitted.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>

http://www.microsoft.com/resources/d...ionelement.asp
"Q. John Chen" <no******@wowway.com> wrote in message
news:84**************************@posting.google.c om...
All,

I am using Form Authentication with Roles.
E.G. PageA.aspx is permitted for Role "Admin",
and PageB.aspx is permitted for Role "Basic".

When a user of "Basic" role try to access an "Admin" page directly,
Login From shown and he enters his username and password.
He is then AUTHENTICATED but stays on the Login form because
he is not permitted to view the "Admin" pages.

My question is: Is there a way to redirect the user to a
"Not-permitted-page" ?

Thanks

John


Nov 18 '05 #2
Ken,

I don't think that I made my question clear. Here is details:

First, I have a login form. If a user failed to login. It will show
the error right in the login form and ask for re-enter the
identification:
<authentication mode="Forms">
<forms loginUrl="login.aspx" />
</authentication>

I have two page accessable to user in the roles, Admin and Basic in
this example:
<location path="PageA.aspx" >
<system.web>
<authorization>
<allow roles="Admin" />
<deny users="*" />
</authorization>
</system.web>
</location>

<location path="PageB.aspx" >
<system.web>
<authorization>
<allow roles="Basic, Admin" />
<deny users="*" />
</authorization>
</system.web>
</location>

Now, UserB (with 'Basic' role) logins first. Then he types PageA.aspx
in address bar trying to access PageA. He is redirect to the Login
page automatically. But what I wantd is to SHOW a kind of 401 error
page rather than go the the login page.

Thanks

John
Nov 18 '05 #3
I did it this way:

Change the Web.config only limit the anomymous user and allow all
users.
And in individual page, check the role the user is in and redirect to
the proper page.

-- John
Nov 18 '05 #4

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

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
0
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,...
0
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...
0
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...
1
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...
0
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...
1
muto222
php
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.