473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ 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 1551
Hi John,

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

<location path="notpermit ted.aspx">
<system.web>
<authorizatio n>
<allow users="*"/>
</authorization>
</system.web>
</location>

http://www.microsoft.com/resources/d...ionelement.asp
"Q. John Chen" <no******@wowwa y.com> wrote in message
news:84******** *************** ***@posting.goo gle.com...
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:
<authenticati on 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.asp x" >
<system.web>
<authorizatio n>
<allow roles="Admin" />
<deny users="*" />
</authorization>
</system.web>
</location>

<location path="PageB.asp x" >
<system.web>
<authorizatio n>
<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
9342
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"); ?> Should it not redirect to www.google.com? I can't get the header() function to redirect. I'm trying to take an online reservation... the customer fills out
7
15909
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 type="text/javascript"> window.location = "http://www.someserver.com/somePage.html"; </script>
6
6914
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 that either the sub did a redirect or a specific value was specified in the URL. If neither a redirect was done and a certain value was
5
4556
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 a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
10
9012
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
7993
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
7920
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
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
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
8054
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
3900
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
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
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
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.