Project Description
The Redirector makes it easier to manage your own compressed urls. Like tiny url, but uses your domain, instead traffic information shows up in your logs. When urls on the web change links are easy to fix because it's all based on a SharePoint list.

Background
Things I'm learning.

The Redirector is an HttpModule that redirects users to a url that is maintained in a SharePoint list. For example site http://xyz.com/go/102 could really be a short cut for http://office.microsoft.com/en-us/sharepointserver/FX101865111033.aspx or the shourtcut could be http://zyx.com/go/SPLicensing to be more intuitive. These shortcut codes and urls are maintained in a SharePoint list for easy administration and maintenance.
The list is a typical custom SharePoint list using a single line of text for the code and a hyperlink field for the url. If you really don't want to create your own here's a list template - Redirection.stp

The web.config of the site has to be modified in two ways. First by adding the appSettings and secondly by adding the HttpModule reference.

1) The AppSettings is where all of the custom configuration happens
<appSettings>
 <add key="listWebServiceUrl" value="http://theSPSite/_vti_bin/lists.asmx" />
 <add key="listName" value="Redirection" />
 <add key="goKeyword" value="/go/"/>
 <add key="CodeColumn" value="code" />
 <add key="UrlColumn" value="url" />
 <add key="User" value="ListReader" />
 <add key="Password" value="Letmein10" />
 <add key="Domain" value="sdraperserver" />
</appSettings>


appSetting Definitions
KEY DEFINITION
listWebServiceUrl A url to the SharePoint site web services that hosts the redirection list.
listName The name of the list. Not including the site. Just the first given name of the list
goKeyword, CodeColumn, UrlColumn Using the above example:

http://xyz.com/go/102
/go/ is the goKeyword and this sets the entire redirection in process. If there is no /go/ found in the url it doesn’t try to do anything and returns back to processing.
The assumption is that /go/ would be unique enough but in case it’s not it’s configurable here.

Immediately following the /go/ is the key that is used to look up in the SharePoint list. The CodeColumn is the name of the column in the list that we are using as our lookup. The UrlColumn is the hypertext column that holds the url the user will be redirected too.|
User, Password, Domain These are all used to create a credential object that the webservice will use. The idea here is you might want to create a user who can just read from this list.


2) Secondly the web.config needs to be told about the HttpModule:
<system.web>
 <httpModules>
  <add name="Redirector" type="WW.Redirector, Redirector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ad2f6dbc017c452"/>
 </httpModules>
</system.web>


redirector.dll is the HttpModule and it can be placed in the bin of the IIS site in question or it can be placed in the GAC.
Redirection.stp This list can be used or you can creatae your own.

Error handling hasn’t been addressed nor will it ever be. Error handling, reporting, and data validation are all very different from environment to environment. It’s recommended to look at how the organization implements these kinds of functionality and then follow suit.

I'm pretty much done with this project, but you can still reach me at stacyDraper@wildwires.com

Last edited Apr 26, 2009 at 9:31 PM by stacyDraper, version 14