url rewriting - build paths
- by Cristian Boariu
Hi guys,
I have started to work on a site without url rewriting. Now, the request is to use friendly urls so i started to use Intelligencia.UrlRewriter.
Let's take an example:
I have a method:
public static string getCategoriesIndexLink(string category)
{
string baseUrl = getBaseUrl() + (String)HttpContext.GetGlobalResourceObject("Paths", "categorii.index");
return baseUrl.AddQueryParam(CQueryStringParameters.CATEGORY, category);
}
which build this kind of urls
"~/Site/Categorii.aspx?category=$1"
Now i've added the following rule in web.config:
<rewrite url="~/Site/Categorii/(.+)" to="~/Site/Categorii.aspx?category=$1" />
The question is HOW i can make the above method to build that kind of nice url?
So no longer return
"~/Site/Categorii.aspx?category=m1"
but
"~/Site/Categorii/m1"
without beeing needed to modify its structure?
I mean, i have about 30 methods like the one from the above; it would be extremely helpfull if i can be guided to use a regex at the output of the methods iso modifying the url construction...
Thanks in advance...