routing

How does path_prefix and requirements in Rails routes work?

Taking the 2 examples below - how do they work? map.resources :api_developers, :path_prefix => '-' map.connect '-/:controller/:action/:id', :requirements => { :controller => /metrics|labs/ } ...

ASP.NET 4 migrate to routing / mapping

Hi, Previously I was using Rewriter.net to rewrite my urls. I used a format like: <rewrite url="~/(.*)_p(\d+).aspx\??(.*)" to="~/product.aspx?pid=$2&amp;$3"/> So a page url would look like ~/productname_p21.aspx with an optional querystring. I'm upgrading the application to ASP.NET 4 and I would like to use the URL routing in System...

All subdomains routed to same DocumentRoot, apache config

You've seen it done on sites like basecamphq.com where you would have username.basecamphq.com I'm wanting to do a similar thing, any subdomain is routed through to the same index.php file. so username1.example.com will request /home/some/path/to/www (in here is index.php) and username2.example.com will request the same file I have it ...

Optional routing parameter with constraint in ASP.NET MVC 2?

If I have a route like this: routes.Add(new Route("{controller}/{page}", new RouteValueDictionary { { "page", UrlParameter.Optional } }, new RouteValueDictionary { { "page", @"[Pp]age\d+" } }, new MvcRouteHandler() )); Then the route doesn't match when {page} is missing, however if I remov...

IIS returns 403.14 error if a physical path corresponds to url

Is there a way to override IIS and tell it to always let handler handle requests? At the moment if, for example, "path" is an existing folder in root, url is "http://domain.com/path" and there is no "default" document in folder, IIS will return a 403, even if that path is defined in my custom handler. I can't think of anything other than...

asp.net routing on homepage

Hi all, When using routing (asp.net webforms) I want to setup a home route so I can browse articles on the frontpage like this domain.com domain.com/1 domain.com/2 domain.com/3 I have no idea how to setup this routing because ~/ isn't accepted in the route. I tried http://www.domain.com/home/1 which works fine but is less nice ofcours...

Problems with routing and path

Hello, I am new to rails and I have a weird problem i don't understand... I have created a basic application with only one controller. this controller is name routes (for testing purpose...) and it contains index, new and edit actions. I have added a resource in the routes.rb file: map.resources :routes The problem I have is when i...

Reverse rails routing: find the the action name from the URL

I understand how to turn :controller, :action, :etc into a URL. I'm looking to do the reverse, how can the action that the rails router will call be found from the URL? ...

Alias for specific resourceful route's action ("/sign_in" instead of "/sessions/new")

I set up restful authentication and user management without any gems in Rails 3. However, I think it's silly to need to go to "/sessions/new" instead of "/sign_in". I know you can alias an entire resource, so that instead of "/sessions"-and-friends my users could use "/squirrels"-and-friends, but that's not what I'm trying to accomplis...

Singular resources namespaced by its slug (Routing)

Hi, I have the followed Rails 3 routes: Hello::Application.routes.draw do resources :blogs do resources :articles do resources :comments end end end By raking them, we can find: GET /blogs/:blog_id/articles/:article_id/comments(.:format) {:action=>"index", :controller=>"comment...

RoR routing very basic problem

I have Exam controller. In routes.rb there is "resources :exams" In controller there are REST-like generated methods. I want to add my own method there: def search @exams = Exam.where("name like ?", params[:q]) end In view file: <%= form_tag(search_path, :method => "post") do %> <%= label_tag(:q, "Szukaj: ") %> <%= text_fie...

can .net mvc routing cause javascript errors

Hi guys, now a days i m having hell a lot of trouble using routing infrastructure of asp.net mvc2. i have following routes registered in my global.asax file routes.MapRoute( "strict", "{controller}.mvc/{docid}/{action}/{id}", new { action = "Index", id = "", docid = "" }, new { do...

Abort Routing and continue with the original request in .NET

I want to use routing for all incomming calls to my server and then only use the routing on some of these (depending on values in my database). I know how routing is done, what I don't know is how to abort routing inside my IRouteHandler. ex if (routing) { // do routing var page = BuildManager.CreateInstanceFromVirtualPath(Vir...

Egress filtering against IP spoofing

How widely applied is anti-IP-spoofing egress filtering? ...

Use routing in HTTPHandler

Hello, I want to use HTTP Handler in order to create a RSS feeds. For the purpose, I want to put my logic for creating the rss XML in C# class, which implement IHttpHandler, then to "map" this handler into the web.config file and to register the "mapped name" in my routing rules. I am doing something like this: My HTTPHanlder: ...

How to get the url to the current action (after modifying some route data)?

I'm localising a site via a Change Language control in the master page. I need to render the control with the current url you're on in each of the different languages. So if you're on http://site.com/en/Home/About and you change the language to french, I need to direct you to http://site.com/fr/Home/About. The localisation code works o...

Override method for default RESTFUL Routes in Rails

Given a line something like below in routes.rb map.resources :users The routes generated might be something like this: users GET /users(.:format) {:controller=>"users", :action=>"index"} POST /users(.:format) {:controller=>"users", :action=>"create"} new_user GET /users/new(.:format) ...

Listing Cities not in Database in CakePHP

I have an application in CakePHP that lists businesses. I have a business model/controller, as well as a state_list model/controller. However I want to be more detailed so when a user clicks on a State page, it lists all the cities in that particular State that businesses are listed in. Then when they click a particular city it then show...

Webform routing home page in a folder like mvc rather than root of site

Hi, I've got webform routing setup on my asp.net webforms 3.5sp1 project. I would like to have the files for the site in a directory called content including the home page as I would like to run multiple sites using the same system. In MVC there is a blank default page and the home page is in a folder called home. I can't seem to repli...

Combining Option Routes in Rails 2.3

I'm tring to setup a Route like so: GET /settings/ PUT /settings/ GET /settings/photos PUT /settings/photos This is the routing code that I have setup for it: #I just do this for code reuse get = { :method => :get } put = { :method => :put } pub.settings '/settings', :controller => :settings, :action => :index, :conditions => get pub...