routing

Rails, Restful Routes, and Awesome Nested Set

I have a data structure that is basically a tree using :wesome nested set: class category acts_as_nested_set What I want to achieve are routes like /categories/1/children/ /categories/1/children/new I know I could fake it by making a separate controller, but it seems a bit non-DRY. Are there any better ways to do this? ...

Dealing ASP.net Routes with n slashes using regex

I need to use a URL like this: http://mydomain.com/Box/Categ1/Categ2/Categ3/.../CategN/id1,id2,id3,...,idN Then I tried to create a new route this way... routes.MapRoute( "Box", "Box/{data}", new { controller = "Box", action = "Index"}, new { data = @"([a-zA-Z0-9-,]+/?)+" } ); But it just doesn't work. If I use any c...

.NET Routing match all pattern (wildcard) with exceptions

If say I have a route that is defined like this: "{books}/{*all}", then any URL that have a root folder defined will match it (i.e. http://mysite.com/greekbooks/somethingirrelavant.htm). But what if I wanted to go further, and would like to present a custom handler for greekbooks published in 1982 (i.e. the url http://mysite.com/greekb...

Separate Website From Application with VirtualHosts

I would like to host 1 part of my project on the www.domain.com and domain.com, but if it's not either of those, route it to another separate site on the same box. This should explain what I am trying to do, but no clue how to go about it: <VirtualHost *> <Directory /var/www/domain> Options FollowSymLinks Al...

Creat a list of links from controller actions ASP.NET MVC

Is there a way to make a list of links for each action in controller instead of having to add <li><%= Html.ActionLink("Link Name", "Index", "Home")%></li> for each item? ...

The Rails way to change URL based on variable? Routing and perhaps namespace related.

I have an images table with a nsfw flag. What's the best way to add nsfw and sfw to the URL? For example, if I have an image with an id=1 and nsfw flag is true, I want the URL to be /images/nsfw/1 if I have an image with an id=2 and nsfw flag is false, I want the URL to be /images/sfw/2 ...

How to configure my app to not list all available actions in my Users controller?

When I navigate to: http://localhost:3000/users/1 I get a page that says simply: Unknown action No action responded to show. Actions: create, current_user, logged_in?, login_required, new, and redirect_to_target_or_default Isn't this a security risk since it tells users of my app exactly which methods are available in my User...

ZF Route how to avoid overide ?

Hi, I have, I believe, a simple problem, but I don't know how to solve it... So, I have the standard app with default and admin module. And I need some SEO friendly urls. In admin module I want to use standard urls like /admin/controller/action but I am killing this when I add the following code in my bootstrap file... $model_inf...

Zend Framwork - Route module on subdomain

I'm having trouble getting the Zend_Controller_Router_Route_Hostname to work properly. I'm using Zend Framework 1.9.4 In my config I have: resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.www.route = ":module.domain" resources.router.routes.www.defaults.module = "frontend" resources.r...

Mapping Castle MonoRail default requests to a controller action

Hi, I'm running a MonoRail application that has no routing configured. So I'm using MRs standard Area/Controller/Action.aspx scheme. (I changed the MonoRail handler to listen for .aspx requests). Now, the problem here is that /Home/Index.aspx is my start-page, yet if someone comes to http://server.com/ it's not transferred to /Home/Ind...

MVC routing doesn't pickup querystring

Hello all, in my Global.ascx.cs, I have this setting for the routing: routes.MapRoute( "HomeTarget", "{TargetCode}", new { controller = "Home", action = "Index", TargetCode = "" }); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // U...

ASP.NET MVC - Rewritting FormMethod.Get querystring?

Hello all, I have a simple form with just one textbox and one submit button. The form basically sends to a different page with the value in the textbox as querystring. When I click on the submit button, the querystring is in this format, for example: mysite.com/?TargetCode=Test1 I would like it to display in this format: mysite.com/T...

A bug in the routing engine for .NET?

Hi guys, I have an ASP.NET MVC application. In the application, I have a bunch of similarly structured routes for different actions: /Admin/Addresses/{AddressId}/Delete /Admin/Phones/{PhoneId}/Delete /Admin/Notes/{NoteId}/Delete /Admin/Files/{FileId}/Delete None of which work... I have been checking the routes and the actions for 5 ho...

ASP.NET routing with optional URL segments

I'm working on an ASP.NET MVC task list and I'd like to get fancy with the URL routing when filtering the list. I have an action method defined like this: public ActionResult List(int categoryID, bool showCompleted, TaskFilter filter); enum TaskFilter { MyTasks, MyDepartmentTasks, AllTasks } I want my URLs to look like this: /Tasks/...

route in rails to point to an image in the database

Hi. I'm using a paperclip plugin with an extension to write to the database. The default looks like: /screenshots/photos/24?style=thumb which gets caught already by the default routing in routes.rb. I want to set it to :url =>':relative_root/:class/:attachment/:id/:style/:basename.:extension' (This produces URLs that I like on the pag...

Paging and routing in ASP.Net MVC

I am following Martijn Boland's 'Paging with ASP.NET MVC'. And while helpful it has raised a couple of issues I don't understand. Martijn says: Internally, the pager uses RouteTable.Routes.GetVirtualPath() to render the url’s so the page url’s can be configured via routing to create nice looking url’s like for example ‘/Ca...

problem with friendly URLs routing by name instead of ID

I have a route in my code that looks like this: map.app 'applications/:title_header', :controller => 'apps', :action => 'show' I also changed my show method in the controller to be like this: @app = App.find_by_title_header(params[:title_header]) If I type in applications/title things work fine. If I type in applications/1 (valid I...

How to use a select to go to the Show action of another controller?

I'm trying to do something I thought easy and natural but I'm struggling.. On the homepage of my website, I want a select containing a list of users. After selecting a user and clicking on a button, it should go to the show action of the User controller page. I searched and found differents answers that I don't find very elegant: usi...

Rails rendering a new object as an edit?

I have an application where I'm creating a new object via a "new" action. Rails is using the correct controller action, and also rendering out the new form correctly. However, the path for the form is coming up with an Id for an edit which is breaking things. The form tag is just: <% form_for @issue do |f| etc Any ideas as to why ...

Deploying ASP.NET MVC 2 Preview 2 with Areas

We migrated from MVC 2 Preview 1 to MVC 2 Preview 2 to using multi-project areas. Everything works perfectly on local dev machine (Visual Studio 2008 SP1/IIS 7), however, it's does not work after I publish it to the server (Windows Server 2003/IIS 6). The deployment is done through the Build->Publish option in the VS2008 menu. I had als...