where the translation url->content happens?

Topics: Developer Forum, User Forum
May 28, 2007 at 3:42 PM
I'm playing with your cms, but I'm having some problems in understanding how it works, partly because I haven't a good knowldege of C# and asp.net.
It would be great if you could you tell me how (and in which classes) n2 intercept the url in the request and serves the content associated with it.
thank you,

Michele
Coordinator
May 28, 2007 at 5:59 PM

sm670298 wrote:
It would be great if you could you tell me how (and in which classes) n2 intercept the url in the request and serves the content associated with it.


Michele,

I've recently moved this code into N2.Web.DefaultRequestLifeCycleHandler (if you download the latest check in).

Basically it's like this:
  • At application init the N2.Web.InitializerModule calls the DefaultRequestLifeCycleHandler
  • The DefaultRequestLifeCycleHandler subscribes to the BeginRequest event provided by ASP.NET
  • At BeginRequest the ball is passed to the UrlRewriter class
  • The UrlRewriter calls the ASP.NET method RewritePath (the actual trick)
  • When the page gets content data through the "CurrentPage" property the item with the id defined by the querystring parameter "page" is served.

Hope this explains it somewhat. Good luck!

Cristian
May 29, 2007 at 9:55 AM
Thank you for your answer, it's very clear and that is precisely what I wanted to know.

Michele