Click here to Skip to main content
15,041,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hi to all
I am facing problem to rewrite the url for more then 3 pages
iam using urlrewrite http module
<httpModules><add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/></httpModules>


    <rewrite url="~/(.+)-(.+)_aspx" to="~/ViewVideos.aspx?mID=$2"/>
    <rewrite url="~/(.+)-(.+)-aspx" to="~/ViewGalery.aspx?GID=$2"/>
   <rewrite url="~/(.+)-(.+).aspx" to="~/ViewPage.aspx?TitleID=$2"/>


the below code i am using inside page
public static string GenerateURL(object Title, object strId)
        string strTitle = Title.ToString();

        #region Generate SEO Friendly URL based on Title
        //Trim Start and End Spaces.
        strTitle = strTitle.Trim();

        //Trim "-" Hyphen
        strTitle = strTitle.Trim('-');

        strTitle = strTitle.ToLower();
        char[] chars = @"$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray();
        strTitle = strTitle.Replace("c#", "C-Sharp");
        strTitle = strTitle.Replace("", "VB-Net");
        strTitle = strTitle.Replace("", "Asp-Net");

        //Replace . with - hyphen
        strTitle = strTitle.Replace(".", "-");

        //Replace Special-Characters
        for (int i = 0; i < chars.Length; i++)
            string strChar = chars.GetValue(i).ToString();
            if (strTitle.Contains(strChar))
                strTitle = strTitle.Replace(strChar, string.Empty);

        //Replace all spaces with one "-" hyphen
        strTitle = strTitle.Replace(" ", "-");

        //Replace multiple "-" hyphen with single "-" hyphen.
        strTitle = strTitle.Replace("--", "-");
        strTitle = strTitle.Replace("---", "-");
        strTitle = strTitle.Replace("----", "-");
        strTitle = strTitle.Replace("-----", "-");
        strTitle = strTitle.Replace("----", "-");
        strTitle = strTitle.Replace("---", "-");
        strTitle = strTitle.Replace("--", "-");

        //Run the code again...
        //Trim Start and End Spaces.
        strTitle = strTitle.Trim();

        //Trim "-" Hyphen
        strTitle = strTitle.Trim('-');

        //Append ID at the end of SEO Friendly URL
        strTitle = strTitle + "-" + strId + ".aspx";

        return strTitle;
now i want to rewrite the url for sub folder pages
i have the sub floder/En
/En i have the Eviewpage and also Default page
now i want to Rewrite the url for Default page links to Eviewpage
these two pages are present in side sub floder
please help me to find the sollution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900