Click here to Skip to main content
15,886,806 members
Articles / Web Development / ASP.NET

Redirector Module

Rate me:
Please Sign up or sign in to vote.
4.68/5 (13 votes)
19 Jan 2010CPOL2 min read 36.1K   389   35  
Build an ASP.NET HttpModule to have normalized URLs, and avoid duplicate content for a SEO friendly website.
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace SampleRedirector.Configuration
{
	public class RedirectorUrlCollection : ConfigurationElementCollection
	{
		protected override ConfigurationElement CreateNewElement()
		{
			return new RedirectorUrl();
		}

		protected override object GetElementKey(ConfigurationElement element)
		{
			return ((RedirectorUrl)(element)).Regex;
		}

		public RedirectorUrl this[int idx]
		{
			get
			{
				return (RedirectorUrl)BaseGet(idx);
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Spain Spain
Jorge has been working in Software development for more than 10 years. Born in Argentina, he lives in Spain since 2004.

He worked as a consultant for mayor companies including Log, HP and Avanade and holds some technical certifications including MCSD and MCAD.

He is the founder of the asp.net mvc forum open source project Nearforums, the Node.js Cassandra driver and the owner of the news release site prsync.com.

Follow him on Twitter: twitter.com/jorgebg

Contact: jorgebaygondra at gmail

Comments and Discussions