Wrox Programmer Forums
|
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 August 9th, 2004, 08:00 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirecting

My default.aspx, which allows all users, has a login button.
I want to have an authenticated user redirected to another specific page, for instance main.aspx, after logging in through the login button (page)

How to do that?

I tried using the FormsAuthentication.RedirectFromLoginPage but I have no control of the page it redirects to

Thanks

 
Old August 9th, 2004, 08:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You can either use Server.Transfer or Response.Redirect.

Server.Transfer("PageToRedirectTo.aspx")

or

Response.Redirect("PageToRedirectTo.aspx")

J
 
Old August 9th, 2004, 08:26 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

"RedirectFromLoginPage" is used for automatically returning you to the page you attempted to access when the application detects that you are not logged in. When the application redirects you to the login page, it tells the login page what page you were trying to get to so it can send you back. Very useful, but not for what you want to do.

You need to use Response.Redirect("main.aspx")

IMPORTANT: You still need to save the login cookie! When you use "RedirectFromLoginPage", ASP.NET writes the authentication cookie AND issues the Response.Redirect for you. If you want to redirect to a specific page, you'll need to first set the login cookie with the FormsAuthentication.SetAuthCookie method then issue your specific redirect.
 
Old August 9th, 2004, 09:02 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks planoie - a very accurate answer






Similar Threads
Thread Thread Starter Forum Replies Last Post
redirecting users t0r3ad0r ASP.NET 1.0 and 1.1 Professional 1 October 5th, 2006 10:32 PM
URL Redirecting ashbmpg Apache Tomcat 0 September 15th, 2006 03:57 AM
Page Redirecting venkatagiri ASP.NET 2.0 Basics 0 June 22nd, 2006 06:17 AM
Redirecting kend Classic ASP Basics 2 July 8th, 2003 04:15 AM





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