Questions tagged [routes]

Questions about mapping URLs to Controllers and Actions.

MVC web application (like Ruby on Rails, ASP.NET MVC, etc) uses routes to map an arbitrary URL to a specific controller/action.

For example

http://example.com/foo/bar/23

Might pass an id 23 to controller foo, action bar.

Unusual URLs could also be mapped

Given controller places and intended action list, we can use routes to allow this URL:

http://example.com/my/places
32975 questions
6
votes
1 answer

Rails 5 - in link_to, how to pass a nil (NULL) param?

I have a link where I need to pass a sequence of params, where 2 params are always nill. link_to go_to_action_path(id, par_01, par_02, par_03, par_04) In some cases are the par_01 and par_02 nil, in other par_03 and par_04. If I have these values…
user984621
  • 46,344
  • 73
  • 224
  • 412
6
votes
1 answer

ASP.NET MVC Get Route values from a URL

I want to work out what the route values for the UrlReferrer in the controller action would be. I can't figure out at what part in the MVC pipeline the incoming URL is converted into RouteValues, what I'm trying to achieve is close to that.
Kirschstein
  • 14,570
  • 14
  • 61
  • 79
6
votes
1 answer

Where to declare Angular catch all (Not found) route

I have a main app.routing.module.ts as so: const routes: Routes = [ { path: 'home', component: HomeComponent }, { path: 'login', component: LoginComponent }, { path: '', redirectTo: '/home', pathMatch: 'full' } ]; @NgModule({ imports: [ …
lahsrah
  • 9,013
  • 5
  • 37
  • 67
6
votes
3 answers

Route/Bridge docker virtual adapter with zerotier virtual adapter

I have a bunch of servers running in docker containers with docker-for-windows. Because of how docker works on windows these all get shoved inside of hyper-v vm and then the containers run there. So to access a server that is bound to localhost, i…
Stephen Eckels
  • 435
  • 6
  • 17
6
votes
2 answers

Using variables across Flask routes

I am learning Flask and have a question regarding use of variables in the context of routes.For Example, my app.py: from flask import Flask, render_template app = Flask(__name__) @app.route("/index") def index(): a=3 b=4 c=a+b return…
James Wonder
  • 113
  • 2
  • 2
  • 11
6
votes
1 answer

Out of range Ids in Symfony route

I have a common structure for Symfony controller (using FOSRestBundle) /** * @Route\Get("users/{id}", requirements={"userId" = "(\d+)"}) */ public function getUserAction(User $user) { } Now if I request http://localhost/users/1 everything is…
klipach
  • 818
  • 7
  • 21
6
votes
1 answer

How to pass variable from route to controller Node.js JavaScript

So I have a user view and an admin view that are very similar except that an admin view can upload new data to my web app which displays different charts; thus I want to use the same controller that gets the data from the database. In the…
6
votes
2 answers

Python Linux route table lookup

I posted Python find first network hop about trying to find the first hop and the more I thought about it, the easier it seemed like it would be a process the routing table in python. I'm not a programmer, I don't know what I'm doing. :p This is…
tMC
  • 18,105
  • 14
  • 62
  • 98
6
votes
1 answer

Avoiding "Request matched multiple actions resulting in ambiguity" error in ASP.Net Core

I am trying to do something simple and trivial - or at least I thought. I am trying to write a base class that can be inherited by each micro-service project I spin up. The point of this base class is to test connectivity from HTTP all the way…
Keith Barrows
  • 24,802
  • 26
  • 88
  • 134
6
votes
1 answer

ASP.NET MVC Html.ActionLink result URL - the way of encoding

I create an amount of actions in MVC controllers. public ActionResult DoSmth1(string token) public ActionResult DoAnother2(string token) And when I have to call ActionLink.. =Html.ActionLink( x=> x.DoSmth(item.property),…
Sketch
6
votes
3 answers

Create Route for a specific URL without changing the URL with MVC

I have a MVC Web Application that runs on www.domain.com and I need to configure a different URL binding for another domain www.domain2.com for the same web application. The new domain www.domain2.com will have to return a specific Controller Action…
Patrick
  • 2,995
  • 14
  • 64
  • 125
6
votes
2 answers

Can anyone recreate the following bug I'm experiencing in routes with 2 or more optional parameters, in .NET 4.0 / MVC3?

I know that if you think you found a bug in the .NET framework you are most likely wrong, but that's why I'm writing this question, so please hear me out. I am fairly certain that there is a difference between the routes in .NET 3.5 and .NET 4.0…
JohannesH
  • 6,430
  • 5
  • 37
  • 71
6
votes
1 answer

Get the name of the current route in Laravel 5.5

I know that in previous versions of Laravel you could fetch the name by calling the getCurrentRoute in the route class, but since 5.5 was released it still remains a mystery on how I can do this? In previous versions, this is how I did…
Adam Craft
  • 63
  • 4
6
votes
3 answers

No route matches controller show - scaffold generated code

I started a Rails app using scaffold. The app relates people to institutions. When I go to http://localhost:3000/people I get the following error: No route matches {:controller=>"people", :action=>"show", :id=>#
Libby
  • 581
  • 2
  • 6
  • 21
6
votes
2 answers

Routes not working codeigniter

Routes not working and default controller showing error 404 when I am setting welcome as a default controller then all routes defined with the welcome controller working but my other routes and url not working. $route['default_controller'] =…
Roshan Lal
  • 61
  • 1
  • 1
  • 2
1 2 3
99
100