routing

Customizing map.resources in Rails

Suppose I have a Book model, which contains many Page models. The routing for this would be as so: map.resources :books do |book| book.resources :pages end Following the Rails default on this quickly leads to problems. Suppose Book #1 has 10 pages. The first Page in Book #2 will have this route: /books/2/pages/11 This is a pre...

How do I fix default CakePHP routing on a "baked" MVC?

I just set up a database according to CakePHP's conventions, ran the "bake" scripts for models, controllers and views, and made sure the path was set up correctly. When I go to the following style of URL: http://BASEURL/app/controller_name I get the expected list view for that controller, but all the links generated by baked pages ar...

form_for tag for a resource with two different controllers and RESTful routing

I have a Rails app with a "Route" resource, and a "Route" controller (not to be confused w/ Rails routes). I've set it up so that the site admins (and only the admins) can manage the "Route" resource through the "Route" controller, while regular users manage their routes with a "Myroute" controller. I want both controllers to utilize R...

ASP.NET MVC: action methods with one param not named ID and non-integer

Consider an ASP.NET MVC 1.0 project using the Areas convention as described on this Nov. 2008 Phil Haack blog post. This solution works great once it's set up! My trouble is starting thanks to my limited knowledge of ASP.NET MVC's routing rules. My intention is to create an action method and URL structure like this: http://mysite/...

ASP.NET MVC routing fails when using default.aspx/controller/action style url

I'm deploying an ASP.NET MVC site to a IIS6 webserver, so I'm using a default.aspx/{controller}/{action} style routing strategy. However, for some reason it doesn't really work when using the default.aspx part. No matter the url, it always gets the default action (Index) on the default controller (Public). I've been using the excellent...

Html.ActionLink construct wrong link when a non-mvc route is added

Hi there, I have an application here with a mix of webform and mvc. I specify the routing as below routes.Add("AspxRoute", new Route("Upload/New", new WebFormRouteHandler<Page>("~/Uploads.aspx"))); routes.MapRoute( "Default", // Route name "{controlle...

I need a simple example of asp.net routing

if the user type http://myweb/mysite.aspx (file does not exist) I want them to go to http://myweb/site.aspx (file does exist) My goal is to make a bilingual website (including url) but without having to make physical file this would be one file http://myweb/acceuil.aspx http://myweb/home.aspx ...

ASP.NET Routing using wrong route to generate URL; route values become query string parameters

Relevant route registration code: routes.MapRoute( "QuestionsMostRecent", "questions", new { controller = "questions", action = "most_recent" } ); routes.MapRoute( "ControllerActionFormat", "{controller}/{action}.{format}" ); Route generation code: Url.RouteUrl(new { controller = "questions", action = "most_recent"...

RoutingError inside an iFrame

I scaffolded a test app and got a Routing error when I put an iFrame inside my view: This is the show template where I added the iFrame: views/bars/show.html.erb: <p> <b>Body:</b> <%=h @bar.body %> </p> <iframe src=“http://www.yahoo.com” style=“width:500px; height:500px;” frameborder=“0?></iframe> <%= link_to 'Edit', edit_bar_p...

ASP.NET MVC One Way Route

Is it possible to define a route in the RouteCollection of Asp.net MVC, so that it just does the "URL rewriting" part and ignore the URL generation with Html.Actionlink(...)? In fact I want to add a keyword between controller and action (controller/..keyword.../action) for certain very special requests. The generated URLs on the pages, ...

Hard coding routes in Rails

Let's say I have this: <%= link_to "My Big Link", page_path(:id => 4) %> And in my page.rb I want to show urls by their permalink so I use the standard: def to_param "#{id}-#{title.parameterize}" end Now when I click "My Big Link" it takes me to the correct page, but the url in the address bar does not display the desired pe...

URL routing, from domain.com/dir/ to otherDomain.com?

Hello! If I have a website at myFirstDomain.com/dir/, is it possible to get mySecondDomain.com to point to myFirstDomain.com/dir/ so that when users browse at the directed site, they only see mySecondDomain.com/potentialSubDirFromMyFirstDomain/ or how does it work? ...

Which method to use to set up a dynamic port mapper

I have a web app which relies on a number of back end services, and I would like to be able to dynamically switch between different instances of these services. So the thinking was to create an intermediate app which listens on some ports and redirects traffic as required. If I was dealing with pure HTTP I would look at doing this with...

Ruby On Rails Routes Problem

Hi Guys, I am have started learning Rails, it was going good until now. I am using HAML and have this on my index.haml = submit_to_remote "submit_btn", "Create", :url => {:controller => "queries", :action => "create"}, :method => "post" = submit_to_remote "exe_btn", "Execute", :url => {:controller => "queries", :action => "execute"},...

Http Modules are called on every request when using mvc/routing module

I am developing a http module that hooks into the FormsAuthentication Module through the Authenticate event. While debugging i noticed that the module (and all other modules registered) gets hit every single time the client requests a resource (also when it requests images, stylesheets, javascript files (etc.)). This happens both when r...

What package do i need to install for using routing sockets?

i am trying code given in Unix Network Programming by Richard Stevens. but i am not able to get the code to compile. here is the source code. http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15213-f00/unpv12e/libroute/ i don't have the header file net/if_dl.h and the net/route.h header file does not include the constants and structu...

Changing a Rails route based on deployment type

Is there a good way of modifying a route based on the deployment type? Basically, I have a route that has a :requirements => {:protocol => "https"}, and I'd like that to only happen in production, but not in development. ...

asp.net mvc routes over https ssl

I have a website that uses Routes to do some URL rewriting. Note, I am not using MVC..just the Routes that make MVC famous :P Anyways the site works completely well...and all is well I enabled SSL on the entire site and accessing the site in https, I can get static files..I can access the aspx files directly...but the Routes no longer ...

Is there a way to filter unsupported formats in the routes file?

I have a Rails app that's getting hit by ScanAlert calling /login.php, but the app is throwing a 500. I'd like to filter any format that's not supported by my site, and 404 instead. My original inclination was to create a before_filter in application_controller.rb that removes any :format that's not :html, :xml, or :js, then render 404....

ASP.NET MVC - Go to a different view without changing URL

Hello all, is it possible to go to a different View without changing the URL? For example in my Index View, I have a link to go the the Details View but I would like to keep the URL the same. Thank you very much, Kenny. ...