tag:blogger.com,1999:blog-32696142.post7745248701097171309..comments2024-02-19T01:02:59.086-06:00Comments on ASP.Net, C#, SQL, JQuery, Sharepoint: Generate URL - SEO Friendly Asp.netUnknownnoreply@blogger.comBlogger7125tag:blogger.com,1999:blog-32696142.post-12336998109321444302009-10-27T00:38:29.185-05:002009-10-27T00:38:29.185-05:00I just created simple function.
public static str...I just created simple function.<br /><br />public static string createURL(string m_strURL)<br /> {<br /> //m_strURL = m_strURL.Replace("&", "and");<br /> m_strURL = Regex.Replace(m_strURL, @"[^\w]", "-");<br /> do<br /> {<br /> m_strURL = m_strURL.Replace("--", "-");<br /> } while (Asif Iqbalhttps://www.blogger.com/profile/04929548616730016215noreply@blogger.comtag:blogger.com,1999:blog-32696142.post-55131799526949302642009-07-05T06:08:13.728-05:002009-07-05T06:08:13.728-05:00Hi Ray,
Your solution is helpful and easy. Thank...Hi Ray,<br /><br />Your solution is helpful and easy. Thanks :)DotNetGutshttps://www.blogger.com/profile/12732063013510099746noreply@blogger.comtag:blogger.com,1999:blog-32696142.post-36347388012879873112009-07-05T02:46:30.475-05:002009-07-05T02:46:30.475-05:00try this:
using System.Text.RegularExpressions;
...try this:<br /><br />using System.Text.RegularExpressions;<br /><br /> public string GenerateURL(string str,bool toLowerCase)<br /> {<br /> //Replace . with - hyphen<br /> str = Regex.Replace(str.Trim(), @"\W", "-");<br /><br /> //Replace multiple "-" hyphen with single "-" hyphen.<br /> str = Rayhttps://www.blogger.com/profile/15194312854544160897noreply@blogger.comtag:blogger.com,1999:blog-32696142.post-67048448498954600452008-12-31T17:25:00.000-06:002008-12-31T17:25:00.000-06:00Using string.replace multiple times in ADDITION to...Using string.replace multiple times in ADDITION to the loop seems a bit expensive.<BR/><BR/>Take a look at http://horizonguy.wordpress.com/2008/10/18/optimize-a-url-for-seo-using-c<BR/><BR/>It's using hash table for char lookups and buffer for building the url.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-32696142.post-61779078734863429182008-07-24T15:50:00.000-05:002008-07-24T15:50:00.000-05:00Check out article on URL Rewriting Simplest Articl...<B>Check out article on URL Rewriting <A HREF="http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.html" REL="nofollow">Simplest Article for URL Rewriting</A></B>DotNetGutshttps://www.blogger.com/profile/12732063013510099746noreply@blogger.comtag:blogger.com,1999:blog-32696142.post-4325787867517157292008-07-23T20:29:00.000-05:002008-07-23T20:29:00.000-05:00Yes regular expression is the best way to tackle t...Yes regular expression is the best way to tackle this, but if you focus on code logic, you wil feel it would consume more time to develop this stuff with regular-expression (as I am not good with it).DotNetGutshttps://www.blogger.com/profile/12732063013510099746noreply@blogger.comtag:blogger.com,1999:blog-32696142.post-23872834435979327962008-07-23T20:12:00.000-05:002008-07-23T20:12:00.000-05:00Isn't there some sort of regular expression that c...Isn't there some sort of regular expression that can do this in a single statement?Arthur Chaparyanhttps://www.blogger.com/profile/08398297915539845058noreply@blogger.com