Hi Justin,
Trying to diagnose those routing issues is quite painful, I've been
there before!
Try to add the following route as the first route:
RoutingModuleEx.Engine.Add(
new PatternRoute("HomeRoute", "/")
.DefaultForController().Is("Home")
.DefaultForAction().Is("Index")
);
And then replace:
RoutingModuleEx.Engine.Add(
new PatternRoute("Home", "/[controller]")
.DefaultForArea().IsEmpty
.DefaultForController().Is("Home")
.DefaultForAction().Is("Index")
);
with
RoutingModuleEx.Engine.Add(
new PatternRoute("DefaultActionRoute", "/
<controller>")
.DefaultForAction().Is("Index")
);
Hope this helps!
Cheers
John
On Jun 10, 5:08 am, Justin <[email protected]> wrote:
> My Castle.MonoRail.Framework dll says version 2.1.0.0.
>
> The error only happens sometimes, then if you wait 5-10 minutes it
> will go away and the page will load fine.
>
> The routing rules are in the Application_Start event. The other rules
> work fine:
>
> RoutingModuleEx.Engine.Add(new PatternRoute("login", "/
> login").DefaultForArea().Is("user").DefaultForController().Is("login").DefaultForAction().Is("index"));
> RoutingModuleEx.Engine.Add(new PatternRoute("logout", "/
> logout").DefaultForArea().Is("user").DefaultForController().Is("login").DefaultForAction().Is("logout"));
> RoutingModuleEx.Engine.Add(new PatternRoute("register", "/
> register").DefaultForArea().Is("user").DefaultForController().Is("register").DefaultForAction().Is("index"));
> RoutingModuleEx.Engine.Add(new PatternRoute("adminhome", "/
> admin/campus/
> index").DefaultForArea().Is("admin").DefaultForController().Is("campus").DefaultForAction().Is("index"));
> RoutingModuleEx.Engine.Add(new PatternRoute("directory", "/
> directory").DefaultForArea().Is("business").DefaultForController().Is("directory").DefaultForAction().Is("index"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("directorylist", "/
> directorylist").DefaultForArea().Is("business").DefaultForController().Is("directory").DefaultForAction().Is("list"));
> RoutingModuleEx.Engine.Add(new PatternRoute("userprofile",
> "/profile/
> <id>/").DefaultForArea().Is("user").DefaultForController().Is("profile").DefaultForAction().Is("view").DefaultFor("which").Is("viewprofile"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("userprofilespecific", "/profile/<id>/
> <which>").DefaultForArea().Is("user").DefaultForController().Is("profile").DefaultForAction().Is("view").DefaultFor("which").Is("viewprofile"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("businessregister", "/register/
> business").DefaultForArea().Is("user").DefaultForController().Is("register").DefaultForAction().Is("business"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("businessregisterverify", "/register/
> businessverify").DefaultForArea().Is("user").DefaultForController().Is("register").DefaultForAction().Is("businessverify"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("businessregisterupgrade", "/register/
> businessupgrade").DefaultForArea().Is("user").DefaultForController().Is("register").DefaultForAction().Is("businessupgrade"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("mybusinesses", "/
> mybusinesses").DefaultForArea().Is("user").DefaultForController().Is("business").DefaultForAction().Is("index"));
> RoutingModuleEx.Engine.Add(new
> PatternRoute("businessdashboard", "/
> businessdashboard").DefaultForArea().Is("user").DefaultForController().Is("business").DefaultForAction().Is("dashboard"));
>
> RoutingModuleEx.Engine.Add(
> new PatternRoute("Home", "/[controller]")
> .DefaultForArea().IsEmpty
> .DefaultForController().Is("Home")
> .DefaultForAction().Is("Index")
> );
>
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<year>/<month>/<day>/<title>")
> .DefaultForController().Is("post")
> .DefaultForAction().Is("show")
> .Restrict("year").ValidInteger
> .Restrict("month").ValidInteger
> .Restrict("day").ValidInteger
> .Restrict("title").ValidRegex("^[^\"\\./]+$")
> );
>
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/tag/[tagname]")
> .DefaultForAction().Is("View")
> .DefaultForArea().IsEmpty
> .DefaultForController().Is("Tags")
> );
>
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<area>/[controller]")
> .Restrict("area").AnyOf("admin", "business",
> "user", "help")
> .DefaultForController().Is("Campus")
> .DefaultForAction().Is("Index")
> );
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<area>/<controller>/<action>")
> .Restrict("area").AnyOf("admin", "business",
> "user", "help")
> );
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<area>/<controller>/<id>/<action>")
> .Restrict("area").AnyOf("admin", "business",
> "user", "help")
> .Restrict("id").ValidInteger
> );
>
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<controller>/<action>")
> .DefaultForArea().IsEmpty
> );
> RoutingModuleEx.Engine.Add(
> new PatternRoute("/<controller>/<id>/<action>")
> .DefaultForArea().IsEmpty
> .Restrict("id").ValidInteger
> );
>
> On Jun 9, 12:42 am, Ken Egozi <[email protected]> wrote:
>
>
>
>
>
>
>
> > Global asax is a big place. Where exactly did you put that rule? Which
> > version of monorail are you using? Are you also using other routing
> > rules ? How are you registering them? Is the problem always happening
> > or does is fail sometimes but works other times?
>
> > On 9 ביונ 2011, at 05:33, Justin <[email protected]> wrote:
>
> > > Hi guys,
>
> > > On our production monorail web site we're getting the following error
> > > intermittently when users go to the base domain url:
>
> > > Url smaller than 2 tokens
>
> > > In my Global.asax.cs, I have the following route rule which was
> > > suggested in a post by Ken Egozi a while back to fix this but doesn't:
>
> > > RoutingModuleEx.Engine.Add(
> > > new PatternRoute("Home", "/[controller]")
> > > .DefaultForArea().IsEmpty
> > > .DefaultForController().Is("Home")
> > > .DefaultForAction().Is("Index")
> > > );
>
> > > Can someone explain why this error would ever be thrown in Monorail,
> > > as it seems silly to throw an error if the url doesn't have 2 parts to
> > > it (a domain and a subdirectory.) I've been seeing this error for
> > > months and the client is putting on the pressure to get this fixed,
> > > some guidance as to how to resolve this would be greatly appreciated.
> > > Which reminds me, is this fixed in the new Monorail 2.1 RC?
>
> > > Thanks!
> > > Justin
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Castle Project Users" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group
> > > athttp://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
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.