<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Of Ones and Zeros &#187; Sitefinity</title>
	<atom:link href="http://www.ofonesandzeros.com/category/technology/sitefinity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ofonesandzeros.com</link>
	<description>a discussion of software and technology hosted by bryan napier</description>
	<lastBuildDate>Wed, 07 Apr 2010 23:14:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up Sitefinity to forward old Urls to new Urls</title>
		<link>http://www.ofonesandzeros.com/2009/04/27/setting-up-sitefinity-to-forward-old-urls-to-new-urls/</link>
		<comments>http://www.ofonesandzeros.com/2009/04/27/setting-up-sitefinity-to-forward-old-urls-to-new-urls/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 18:32:24 +0000</pubDate>
		<dc:creator>bryan</dc:creator>
				<category><![CDATA[Sitefinity]]></category>

		<guid isPermaLink="false">http://blog.ofonesandzeros.com/2009/04/27/setting-up-sitefinity-to-forward-old-urls-to-new-urls/</guid>
		<description><![CDATA[My colleague Adam Duggan pointed me to an incredible useful post on the Sitefinity support forums: http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bhamhe.aspx.  I mistakenly believed that Sitefinity would support redirecting .ASP files to the new .ASPX counterparts as long as IIS had the .ASP extension associated with the aspnet_isapi.dll runtime.  WRONG!  As indicated in the forum posting by Randy, the [...]]]></description>
			<content:encoded><![CDATA[<p>My colleague Adam Duggan pointed me to an incredible useful post on the Sitefinity support forums: <a title="http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bhamhe.aspx" href="http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bhamhe.aspx">http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bhamhe.aspx</a>.  I mistakenly believed that Sitefinity would support redirecting .ASP files to the new .ASPX counterparts as long as IIS had the .ASP extension associated with the aspnet_isapi.dll runtime.  WRONG!  As indicated in the forum posting by Randy, the following steps are required:</p>
<blockquote><p><strong>Step 1: Configure IIS</strong><br />
What happens if you request a non-existent HTM,ASP page?<br />
By default you will get a canned &#8220;white page&#8221;. When you install the .NET Framework is maps certain file extensions to the ASP.NET ISAPI, aspnet_isapi.dll. Neither HTML nor HTM files are mapped to it (because they are not ASP.NET pages). However, you can configure IIS to treat them as ASP.NET pages and serve our custom error pages.<br />
Run the IIS Manager<br />
Select a web application<br />
Right click and go to Properties<br />
On the Virtual Directory tab click Configuration<br />
In the Extension column find .aspx, double click and copy the full path to aspnet_isapi.dll. It should be something like C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll<br />
Click Add and paste the path in the Executable box<br />
In the Extension box type .html<br />
Make sure Check that file exists is NOT checked<br />
Dismiss all dialogs<br />
<strong>Step 2: Modify Web.Config<br />
</strong><br />
Add as many types as you want into the httphnadler section of your web.config.</p>
<pre class="brush: xml">
&lt;httpHandlers&gt;
&lt;add path=&quot;*.htm&quot; verb=&quot;*&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; validate=&quot;false&quot;/&gt;
&lt;add path=&quot;*.html&quot; verb=&quot;*&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; validate=&quot;false&quot;/&gt;
&lt;add path=&quot;*.asp&quot; verb=&quot;*&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; validate=&quot;false&quot;/&gt;
&lt;/httpHandlers&gt;
</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --><strong>Step 3:  Set Default Page Properties</strong></p>
<ul>
<li>Open Sitefinity Admin</li>
<li>Open the Contact.aspx file.</li>
<li>Click Properties</li>
<li>Expand More Options</li>
<li>Add another URL (~/Contact.htm)</li>
<li>Check the “Redriect to Default URL” box</li>
<li>Save Changes.</li>
</ul>
<p><strong>Step 4: Write code using Telerik API</strong></p>
<p>Add this bit of code to your global.asax</p>
<pre class="brush: c#">

void Application_Error(object sender, EventArgs e)
{
Exception lastException = this.Server.GetLastError();
if (lastException is HttpException)
{
HttpException httpException = (HttpException)lastException;
if (httpException.GetHttpCode() == 404)
{
// get the name of the requested page - just the /thisPage.htm or /DIR/thisPage.asp etc
string pageName = string.Concat(&quot;~&quot;, Request.Url.AbsolutePath.ToString());
// create a new instance of CmsManager
Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
// let’s get the page by passing one of it’s additional url’s
Telerik.Cms.IPage myPage = cmsManager.GetPageByAdditionalUrl(pageName);
// we can cast myPage as ICmsPage and redirect to the Default URL
if (myPage != null)
{
Response.Redirect(((Telerik.Cms.ICmsPage)myPage).DefaultUrl.Url);
this.Server.ClearError();
}
}
}
}
</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->Now if you come to the site with contact.htm and it doesn’t exist, you will be redirected to contact.aspx.</p>
<p>I hope this helps</p></blockquote>
<p>A huge thank-you to Randy for not only figuring this out, but posting the results!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ofonesandzeros.com/2009/04/27/setting-up-sitefinity-to-forward-old-urls-to-new-urls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
