Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?

Follow me on twitter.

Where I work.

Connect with me on LinkedIn

  #2 (permalink)  
Old July 5th, 2010, 02:33 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

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.


Imar Spaanjaars
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!
  #3 (permalink)  
Old July 5th, 2010, 03:59 PM
Friend of Wrox
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts

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.

Follow me on twitter.

Where I work.

Connect with me on LinkedIn


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 03:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.