Here is another version of SEO Friendly URL creation, I had posted already when I used to work in ASP Classic. Lets review short and simple method to create SEO Friendly URL in ASP.NET.
C# Method/Function
public string createSEOTitle(string m_strText)
{
//m_strURL = m_strURL.Replace("&", "and");
m_strText = Regex.Replace(m_strText, @"[^\w]", "-");
do
{
m_strText = m_strText.Replace("--", "-");
} while (m_strText.Contains("--"));
if (m_strText.EndsWith("-"))
m_strText = m_strText.Substring(0, m_strText.Length - 1);
if (m_strText.StartsWith("-"))
m_strText = m_strText.Substring(1, m_strText.Length - 1);
return m_strText.ToLower();
}
I hope it is also would be helpful..
Thank you,
Popularity: 5%






Comments on this entry (3 comments)
Did you like this post? You can share your opinion with us! Simply click here.