Okay, I have somewhat solved it now. Seems like the new routing-engine doesn't even bother with web.config rules, if I did them in GlobalApplication it worked. public override void Application_OnStart() { var rule = new PatternRoute("images", "/images/<id>/<size>.jpg") .DefaultForController().Is<ResourceController>().DefaultForAction().Is("image") .Restrict("id").ValidInteger; RoutingModuleEx.Engine.Add(rule); }
Now it works, but the odd thing is... that after an app-restart, it works, sort of. invalid ids will throw an exception and handled by my rescue. But once I make a successful load of an image, all other requests will get the same image. Explanation: /images/1/mini.jpg <-- works /images/100/big.jpg <-- gives the same image. Should call the rescue. images/1/big.jpg <-- same image, should render a big image. Looking through my logs, I can see that it actually invokes Image() in my ResourceController the frist time, but not anymore after the initial request. Although, the request goes through BeginRequest, AuthenticateRequest and EndRequest atleast. Is there any weird caching per controller that doesn't really get that I pass on other querystring-arguments to the controller with the rewriting? Jimmy Shimizu wrote: > Hi, I'm trying to get the routing working on an IIS7 setup but I'm not > sure if there is IIS7 that gives me problem or if I'm doing something wrong. > > This is my setup: > > <system.webServer> > <modules> > <add name="routingEx" > type="Castle.MonoRail.Framework.Routing.RoutingModuleEx,Castle.MonoRail.Framework" > preCondition="managedHandler" /> > </modules> > <handlers> > <clear /> > <add name="MonoRail" path="*" verb="*" > type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory, > Castle.MonoRail.Framework" preCondition="integratedMode" /> > <add name="vm" verb="*" path="*.vm" > type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" /> > <add name="boo" verb="*" path="*.boo" > type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" /> > <add name="st" verb="*" path="*.st" > type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" /> > </handlers> > <validation validateIntegratedModeConfiguration="false" /> > </system.webServer> > > And in my <monorail> I have: > > <routing> > <rule> > <pattern>/images/(\d+)/(\w+)\.jpg$</pattern> > <replace><![CDATA[ > /resource/image.rails?size=$2&imageID=$1 ]]></replace> > </rule> > </routing> > > > > Basically, what I want to do is replace /images/1/small.jpg to > /resource/image.rails?imageID=1&size=small > > However, it doesn't seem to kick in, since I get > > //Controller not found. Area: 'images' Controller Name: '1' > > //I've read that IIS7 and integrated mode gives you trouble with the > routing, but never any solution to the problem or any real explanation > to why that is. I'm a little dazzled about how .NET actually know about > IEngineContext since I don't specify that anywhere in my Web.config, all > I have is the handler that maps to MonoRailHttpHandlerFactory. Is that > the issue, that the Routing doesn't kick in before the handler? > > And I haven't seen any way to get useful debugdata regarding the routing...? > > When people give example where they configure the routing in code, where > do they do that? Application_OnStart? How do they access RoutingEngineEx > in that case? > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---