473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to change a redirect when using forms-based authentication

Depending on user permissions, I would like to be able to change a redirect
to disallow certain users from going to a bookmarked page for which they
should have no access. Is there a way to modify the redirect in the
<LoginControl>_LoggedIn event?

--
Tim
May 18 '06 #1
2 1217
On Wed, 17 May 2006 18:48:01 -0700, AAOMTim
<AA*****@discussions.microsoft.com> wrote:
Depending on user permissions, I would like to be able to change a redirect
to disallow certain users from going to a bookmarked page for which they
should have no access. Is there a way to modify the redirect in the
<LoginControl>_LoggedIn event?


I think what you are wanting to do is check in the page_load event of
your aspx page. That is, after the authentication has already been
done earlier in the pipeline. What I always do is to check this:

IPrincipal iPrincipal = HttpContext.Current.User;
if (!iPrincipal.Identity.IsAuthenticated)
{
response.redirect...

This way, since I'm looking directly at the cookie I don't have to do
a sql access using Membership.GetUser().

You can also look for roles that are authorized at this point. (that
does take some sql queries though.)

Good luck
Peter Kellner
http://peterkellner.net
May 18 '06 #2
I am trying to avoid adding redirect logic to every page_load event by
handling the redirect directly after the login session.
--
Tim
"PeterKellner" wrote:
On Wed, 17 May 2006 18:48:01 -0700, AAOMTim
<AA*****@discussions.microsoft.com> wrote:
Depending on user permissions, I would like to be able to change a redirect
to disallow certain users from going to a bookmarked page for which they
should have no access. Is there a way to modify the redirect in the
<LoginControl>_LoggedIn event?


I think what you are wanting to do is check in the page_load event of
your aspx page. That is, after the authentication has already been
done earlier in the pipeline. What I always do is to check this:

IPrincipal iPrincipal = HttpContext.Current.User;
if (!iPrincipal.Identity.IsAuthenticated)
{
response.redirect...

This way, since I'm looking directly at the cookie I don't have to do
a sql access using Membership.GetUser().

You can also look for roles that are authorized at this point. (that
does take some sql queries though.)

Good luck
Peter Kellner
http://peterkellner.net

May 18 '06 #3

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

Similar topics

1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
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"); ?>...
2
by: alex p | last post by:
I have create a website that links to other websites, using a response.redirect("URL_OF_WEBSITE") For some reason I have managed to get on top at Google, with these pages that only redirect to a...
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...
2
by: Big E | last post by:
I'm currently using a submit button. When users click submit it goes to the VB code and does a Response.Redirect. The Response.Redirect is very slow. What are the other options for moving between...
4
by: Martin | last post by:
I know this might seem like an odd question. I've got a page that has a few url parameters. There's a couple of modes the page can be entered in, with correspondingly different urls params. ...
1
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun...
7
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
12
by: JenHu | last post by:
Hi all, I have to ask a stupid question: In asp.net, I use Response.Redirect ("Main.aspx") to redirect pages, but what is the syntax of redirect forms in vb.net windows application? I have...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.