Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2007, 05:23 PM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms authorization and dynamic redirect

Looking for a way to dynamically direct users to a specific page based on a value retrieved from the database. I'm using forms authentication to direct them to the login page and verify id/password. After they are authenticated, not all users get directed to the same page. The idea is to use a column in the table that's used to verify id/password (for example, "client"), to dynamically redirect them to a client-specific page. I don't know what client they are until I've completed the validation, so the redirection has to be on-the-fly. Any suggestions?



 
Old September 20th, 2007, 07:45 PM
Authorized User
 
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hericles
Default

Maybe I'm not understanding the complexities of the problem but can't you just return the desired column from the database (selected by id and password) and store the result. Then have an IF loop (or similar) that calls the response.redirect method for each possible value of the result (e.g. clients, new users, whatever). Then the user would log in, the value would be selected from the database and they would be seamlessly redirected to the correct location.
Is that any help?
Steve

"I will prepare and one day my chance will come."
 
Old September 21st, 2007, 10:23 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It may be that simple. I'm not sure.

I'm using the following to redirect them back to the original page after they pass validation -

FormsAuthentication.RedirectFromLoginPage (UserName.Text, Persistent.Checked)

My understanding is that this process also builds the cookie used for authentication. I can certainly replace this with a response.redirect that sends them to the correct page. However, if I have denied anonymous access to the folder containing the page, won't I need the cookie to exist in order for ASP.NET to validate access?

 
Old September 21st, 2007, 02:41 PM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Got this one figured out.

   FormsAuthentication.SetAuthCookie(UserName.Text, false);
   string page;
   page = client + "/ProtectedPage.aspx";
   Response.Redirect(page);

SetAuthCookie creates the cookie for me. Response.Redirect sends me where I need to go. Since I've created the cookie, forms authentication passes.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Windows forms tomlyons .NET Framework 1.x 2 July 4th, 2007 02:16 AM
Regarding authorization harshaghanta ASP.NET 2.0 Professional 1 June 5th, 2006 09:18 PM
Authorization @shish ASP.NET 1.0 and 1.1 Basics 0 March 7th, 2006 06:24 AM
Creating Dynamic Forms with ASP.NET saturdave ASP.NET 1.0 and 1.1 Basics 5 November 23rd, 2004 06:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.