n2 urlrewriter: interaction with 3d party url rewriter

Topics: Developer Forum
Sep 24, 2008 at 10:18 AM
Edited Sep 24, 2008 at 10:24 AM
Hi! Looks like i'm becoming most importunate visitor here, sorry for that.

I'm need to configure some url rewriting rules, for example:

/2008/01/article.html should be translated to /article.html?year=2008&month=01 where article.html is some page serving by N2 cms, which in turn rewritten to article.aspx (N2 template aspx file).

As I see, such translation cannot be done with N2 itself, so I trying to use with conjunction with UrlRewriter.NET (http://urlrewriter.net/)
Unfortunately it's not working, my little investigations come to WebRequestContext.LocalUrl which uses Request.RawUrl instead of Current.Request.Url.PathAndQuery so rewriting performed before is just ignored.

Do you have any ideas about?
Sep 24, 2008 at 10:39 AM
I have modified WebRequestContext to this

public Url LocalUrl
            get { return Url.Parse(Request.Url.PathAndQuery); }

Looks like it's working now. But i'm uncertain, could it break something.
And a question: could it be included into the N2 ?
Sep 24, 2008 at 8:07 PM
If it works we can include it. I think the properties diffear somewhat when doing rewriting and/or postbacks. As an alternative you could use N2 to do the same rewriting. E.g. subscribe to UrlRewriter ItemNotFound and analyse the requested URL.