ASP.Net and C# and DotNet and SEO | 25 Apr 2008 04:34 am

Hello there,

If you were wondering how to do search engine friendly urls in asp.net go no further. The key is the Global.asax file in your root. Put this code in for this example to get the number after /search/dist/ and run the file specified. :-

1
2
3
4
5
6
7
8
9
10
11
 protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext incoming = HttpContext.Current;
string oldpath = incoming.Request.Path.ToString();
if(oldpath.Contains("/search/dist/")){
string[] sstring =new string[6];
sstring=oldpath.Split('/');
//Web_Security.SearchDistributions=Convert.ToInt32();
incoming.RewritePath("~\\search\\Default.aspx?dist=" + sstring[4]);
}
}
DotNet | 26 Oct 2007 05:09 am

I was looking for some code to do with logging errors and came across the Microsoft Enterprise Library. This seems to be a framework for different areas of design and one of them was Logs. It also has some cool stuff on database factory classes so you can create database independant code. Also i found Enterprise Library Contrib
which is an open source extension to the Microsoft Enterprise Library, it has some cool stuff like MySql, SqLite and SqlEx providers.