Recent Articles

Validating a URL with Regular Expressions
I had to build web form that took user input from standard ASP.NET input controls.

Visual Studio 2005 - Publishing Web Site
What's the purpose of site precompilation? As it turns out, improved performance is often brought as an evidence of the benefits of precompilation.

Microsoft Bridging VB6 And .NET Forms
A new toolkit from Microsoft will allow VisualBasic 6 developers to craft .Net WinForms that can be displayed in a VB6 application.

ASP.NET: How to Create Custom Trace Messages
This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005.

How to Use Breakpoints
This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005.

How to Use the Exception Assistant
This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005.

11.10.06


ASP.NET: Permanent Redirection

By Mads Kristensen

The easiest way to make a redirection in ASP.NET is using Response.Redirect(url).

What it actually does is, that it creates a response with the "302 (Object Moved)" status code and the target destination.

It tells the browser that the requested page is temporarily moved to a new location and then the browser makes a request to the new destination.

If the page is permanently moved, then the 302 status code is no longer correct.

Search engines also looks at 301 and 302 redirects differently. Here's a quote from The Internet Digest:

"From a search engine perspective, 301 redirects are the only acceptable way to redirect URLs. In the case of moved pages, search engines will index only the new URL, but will transfer link popularity from the old URL to the new one so that search engine rankings are not affected."

Low Rate eCommerce & Retail Plans

There is no natural way of doing a 301 redirect in ASP.NET, so you have to set the HTTP headers manually.

I've written a small method that illustrates how to do it. All you have to do is to call it from the Page_Load or preferably from Page_Init or in ASP.NET 2.0 Page_PreInit.



About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

About WebProASP
WebProASP is a collection of up to date tutorials and insightful articles designed to help ASP users of any skill level implement successful ASP systems and practices. ASP Strategies and Tactics for Business

WebProASP is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQlProNews.com
ITcertificationNews.com SysAdminNews.com
WebProASP.com WirelessProNews.com
CProgrammingTrends.com ITManagementNews.com




-- WebProAsp is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2006 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



ASP Strategies and Tactics for Business WebProASP News Archives About Us Feedback WebProASP Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact