Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 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 July 5th, 2010, 11:00 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default Response.Redirect vs Server.Transfer

I have a page in a website I am working on which when a user completes a form I want the page to change to another page.

The page they are redirected to is only available once the form has been submitted and this authentication works by creating a cookie and then checking to see if that cookie exists when a user requests that page. This is to prevent users from having to fill out the form multiple times to view this extra page.

Should I be redirecting the user using Response.Redirect or Server.Transfer? I have set it up initially so that the user is redirected using Response.Redirect but I have thought that perhaps it might be better to use Server.Transfer as this would keep the url in the address bar the same meaning there would be less attempts at requesting the page without first filling in the form.

The page does check to see if the cookie exists on load and if it doesn't it redirects to the page containing the form. This also uses Response.Redirect but should this use Server.Transfer as well?

Cheers
__________________
Follow me on twitter.

Where I work.

Connect with me on LinkedIn

Blog
 
Old July 5th, 2010, 02:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Will,

I don't like the idea of security by obscurity very much. If you protected the target page (as you've done) there's no need to hide it.

So, you can use both solutions. Using Response.Redirect makes it easier to bookmark the target page, while Server.Transfer makes it easier to target the first. I guess it all depends on where you want your users to return to.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old July 5th, 2010, 03:59 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

Cheers for the reply.

I guess Response.Redirect would be better so they can then bookmark the resources page. But the form page auto redirects if the cookie is present anyway but I suppose allowing the user to omit that redirection would improve the performance of the site.

Cheers
__________________
Follow me on twitter.

Where I work.

Connect with me on LinkedIn

Blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Diff bet Response.Redirect and Server.Transfer alienaheart ASP.NET 1.0 and 1.1 Basics 1 October 2nd, 2008 12:51 AM
Server.Transfer vs. Response.Redirect mikener BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 April 10th, 2008 04:18 PM
Server.Transfer and Response.redirect lavanyarl ASP.NET 1.x and 2.0 Application Design 1 November 9th, 2004 03:31 AM





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