Hi,
Please See below code "ViewEntry.aspx" in web config file i am using to display post of my blog in the same way i want to use one more page to display categories of my blog.
How to use multiple url in web config file inside the rewriter tag?
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
<rewriter>
<rewrite url="(.+)-(.+).aspx" to="~/ViewEntry.aspx?id=$2"/>
</rewriter>
public static string GenerateURL(object Title, object strId)
{
string strTitle = Title.ToString();
//#region Generate SEO Friendly URL based on Title
strTitle = strTitle.Trim();
strTitle = strTitle.Trim('-');
strTitle = strTitle.ToLower();
char[] chars = @"$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray();
strTitle = strTitle.Replace("c#", "C-Sharp");
strTitle = strTitle.Replace("vb.net", "VB-Net");
strTitle = strTitle.Replace("asp.net", "Asp-Net");
strTitle = strTitle.Replace(".", "-");
for (int i = 0; i < chars.Length; i++)
{
string strChar = chars.GetValue(i).ToString();
if (strTitle.Contains(strChar))
{
strTitle = strTitle.Replace(strChar, string.Empty);
}
}
strTitle = strTitle.Replace(" ", "-");
strTitle = strTitle.Replace("--", "-");
strTitle = strTitle.Replace("---", "-");
strTitle = strTitle.Replace("----", "-");
strTitle = strTitle.Replace("-----", "-");
strTitle = strTitle.Replace("----", "-");
strTitle = strTitle.Replace("---", "-");
strTitle = strTitle.Replace("--", "-");
strTitle = strTitle.Trim();
strTitle = strTitle.Trim('-');
strTitle = "" + strTitle + "-" + strId + ".aspx";
return strTitle;
}
<asp:HyperLink ID="hlTitle" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"sub")%>'
NavigateUrl='<%#GenerateURL(DataBinder.Eval(Container.DataItem,"sub"),
DataBinder.Eval(Container.DataItem,"Id"))%>'></asp:HyperLink>