routes

ASP.NET MVC Route Help, 2 routes, 1 with a category url structure and the other for content page

Hi, I need some help with ASP.NET MVC routes. I need to create 2 routes for a cms type application. One route will be for category level URLS, and the other route will be for the actual page content. categories, always ends in a '/' www.example.com/category/ www.example.com/category/subcategory/ www.example.com/category/subcateg...

What is the best way in Rails to determine if two (or more) given URLs (as strings or hash options) are equal?

I'm wanting a method called same_url? that will return true if the passed in URLs are equal. The passed in URLs might be either params options hash or strings. same_url?({:controller => :foo, :action => :bar}, "http://www.example.com/foo/bar") # => true The Rails Framework helper current_page? seems like a good starting point but I'd ...

Organisation of routes in Rails -- restful_authentication, session and /login

I am struggling with the route setup for a Rails application. I have installed restful_authentication and mostly followed the instructions. I have set up the routes this way: map.login '/login', :controller => 'sessions', :action => 'new' map.logout '/logout', :controller => 'sessions', :action => 'destroy' map.resource :session If yo...

Trailing slashes in Pylons Routes

What is the best way to make trailing slashes not matter in the latest version of Routes (1.10)? I currently am using the clearly non-DRY: map.connect('/logs/', controller='logs', action='logs') map.connect('/logs', controller='logs', action='logs') I think that turning minimization on would do the trick, but am under the impression t...

ASP.NET MVC AcceptVerbs and registering routes

Hi Folks, do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already? eg. i have this. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection formCollection) { .. } do i need to add this to the r...

Route to get all requests that look like www.example.com/asdf234 (no trailing slash allowed)

Hi, I want to catch all URL's in the root folder of the url www.example.com The url cannot end in a trailing slash, and can't contain any slashes at all. so these should pass: www.example.com/abc www.example.com/abc123-asdf www.example.com/abc123/ ** fail! www.example.com/asdfsd/asdf ** FAIL! ...

MVC Dynamic Routes

I would like to create dynamic urls that route to controller actions with an Id value. I've created the following route using a catch-all parameter routes.MapRoute( "RouteName", "{id}/{*Url}", new { controller = "Controller", action = "Action", id = "" ...

How can i make a catch all route to handle '404 page not found' queries for ASP.NET MVC?

Hi folks, Is it possible to create a final route that catches all .. and bounces the user to a 404 view in ASP.NET MVC? NOTE: I don't want to set this up in my IIS settings. ...

can I have a catch all route with the following route?

Hi, I have the default that vs.net creates in a MVC app: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ...

What is the route to catch the default page?

Hi, I don't want to use the default route that vs.net creates: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); I only want the ...

MVC contraint for anything that is only numeric

Hi, I need help with a constraint: Constraints = new RouteValueDictionary(new { filename = @"" }) It has to be only numeric (no letters, slashes etc). ...

Param name and value (independantly) as part of Rails Route

DocumentsController#common_query can handle multiple different request styles. i.e. all docs in batch 4 or all docs tagged "happy" I want a single route to make em pretty, so: /documents/common_query?batch=4 /documents/common_query?tag=happy become: /documents/batch/4 /documents/tag/happy So the end result is that #common_query i...

Url Form Action Without ViewContext

Is it possible to get a URL from an action without knowing ViewContext (e.g., in a controller)? Something like this: LinkBuilder.BuildUrlFromExpression(ViewContext context, Expression<Action<T>> action) ...but using Controller.RouteData instead of ViewContext. I seem to have metal block on this. ...

Creating urls with asp.net MVC and RouteUrl

I would like to get the current URL and append an additional parameter to the url (for example ?id=1) I have defined a route: routes.MapRoute( "GigDayListings", // Route name "gig/list/{year}/{month}/{day}", // URL with parameters new { con...

ASP.NET MVC route question

I have two routes I want mapped in my ASP.NET MVC application /User/Login /User/{userid}/{username}/{action} (e.g. /User/1/blah/profile) Here are the routes I've defined: routes.MapRoute( "Profile", "Users/{userID}/{username}/{action}", new { controller = "Users", action = "Profile" } ); r...

Strange Html.ActionLink() Behavior after Upgrade to Beta 1

I upgraded a large ASP.NET MVC application I've been working on to the latest beta today, and after some initial problems, I've got it mostly working again. The big problem is that I have things like this: <%= Html.ActionLink("LOGIN", "Index", "Authorization", new { redirect=Request.Url })%> and <%= Html.ActionLink("Edit this page"...

Opinion on example.com/username with Routes

I'm setting up a site where users have their own "profile". I'm using routes for neat URLs and I wondered what are the pros/cons to the following: example.com/:username Or should I include a static route to filter that it's a profile page request? example.com/u/:username example.com/something-static/:username Which is best? ...

Asp.Net MVC - Best approach for "dynamic" routing

I am trying to come up with an approach to create "dynamic" routing. What I mean, exactly, is that I want to be able to assign the controller and action of a route for each hit rather than having it mapped directly. For example, a route may look like this "path/{object}" and when that path is hit, a lookup is performed providing the app...

Do you have to mess with Rails's "routes.rb" file?

I never touch routes.rb beyond calling map.root to set a default route. I've always been content to use URLs of the form... /controller/action/perhaps_an_id and it works fine. Does this make me a bad person? Am I missing out on something totally awesome? What if I try to adopt RESTful design? Would that mean I have to edit routes.rb...

"The resource cannot be found." error when there is a "dot" at the end of the url

Hi, I'm using ASP .NET MVC Beta and I get the HTTP 404 (The resource cannot be found) error when I use this url which has a "dot" at the end: http://localhost:81/Title/Edit/Code1. If I remove the dot at the end or the dot is somewhere in the middle I don't get the error. I tried to debug but it I get the error from "System.Web.Cached...