|
||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionMy intention is not for this to be a massive how-to on HTTP Modules - I think this little DLL is quite useful (I know that there are similar libraries out there that does mostly the same). Hopefully, posting it on Code Project will get it out to as many people as possible. BreakdownThe Add this line to your <httpModules>
<add type="Rewriter.Rewrite, Rewriter" name="Rewriter" />
</httpModules>
The interface is implemented as follows: public class Rewrite : System.Web.IHttpModule
{
The public void Init(System.Web.HttpApplication Appl)
{
Appl.BeginRequest+=new System.EventHandler(Rewrite_BeginRequest);
}
The public void Dispose()
{
// Empty
}
The public void Rewrite_BeginRequest(object sender, System.EventArgs args)
{
System.Web.HttpApplication Appl = (System.Web.HttpApplication)sender;
string path = Appl.Request.Path;
string indicator = "/Content/";
... More Code ...
}
This gives the path that we can then process using the private string GetTab(string path, string indicator)
{
...
}
The
public void SendToNewUrl(string url, bool spider,
System.Web.HttpApplication Appl)
{
if (spider)
{
Appl.Context.RewritePath(url);
}
else
{
Appl.Response.Redirect(url, true);
}
}
Fingers crossed, you guys get the gist of the system. This is not a difficult task, but hopefully will make your DotNetNuke sites a little easier for navigation or spidering. Review the There are plenty of additional ways to improve this functionality. Finally, a big thank you goes out to the Code Project and DotNetNuke and their respective communities.
|
|||||||||||||||||||||||||||||||||||||||||||||||