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
57
votes
4 answers

Difference between message bus and message broker

what's the difference between a message bus[1] and a message broker[2] Both is middleware for applications Both can be used to decouple various systems Both can have a canonical data model Both route messages and could offer other features such as…
Zé Carlos
  • 3,627
  • 5
  • 43
  • 51
56
votes
7 answers

ASP.NET MVC Url.Action adds current route values to generated url

I have seen this question a couple of times here in SO but none of them with any acceptable answer: ASP.NET MVC @Url.Action includes current route data ASP.NET MVC implicitly adds route values Basically I have Controller with an action method called…
willvv
  • 8,439
  • 16
  • 66
  • 101
55
votes
3 answers

How to create multilingual translated routes in Laravel

I would like to create application with many translated routes depending on selected language. I've once described it at 3 methods of creating URLs in multilingual websites. In this case it should be the first method from mentioned topic so: I…
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
55
votes
17 answers

Laravel generate secure https URL from route

Edit I can't really find a way to generate a secure URL from route name. To get a full URL, I use echo route('my_route_name'); But what to do, if I want a URL with https?
Mārtiņš Briedis
  • 17,396
  • 5
  • 54
  • 76
55
votes
6 answers

I'm getting a "Does not implement IController" error on images and robots.txt in MVC2

I'm getting a strange error on my webserver for seemingly every file but the .aspx files. Here is an example. Just replace '/robots.txt' with any .jpg name or .gif or whatever and you'll get the idea: The controller for path '/robots.txt' was not…
Ben Lesh
  • 107,825
  • 47
  • 247
  • 232
55
votes
4 answers

Difference between resource and resources in rails routing?

what is the difference between resource and resources in rails routing resource :geocoder and resources :posts What is real difference between them ?
Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
54
votes
6 answers

How can I get the route name in controller in ASP.NET MVC?

ASP.NET MVC routes have names when mapped: routes.MapRoute( "Debug", // Route name -- how can I use this later???? "debug/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = string.Empty } ); Is there a way to…
Mike Scott
  • 12,274
  • 8
  • 40
  • 53
54
votes
3 answers

Possible to create this redirecting route in Rails?

Is it possible to do a redirect in the routes file of a Rails app? Specifically, I'd like to forward /j/e to /javascripts/embed.js Right now the only way I can think to do it is to create a j controller with an e method that redirects to that.
Shpigford
  • 24,748
  • 58
  • 163
  • 252
53
votes
1 answer

How can I parse out points and draw a route on a Google Map in Android?

How do I get points & draw the route on Google maps in Android OS?
Matt Rutkowsky
  • 541
  • 1
  • 5
  • 4
53
votes
6 answers

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

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…
ipek
  • 701
  • 1
  • 6
  • 6
53
votes
5 answers

No route matches missing required keys: [:id]

I'm new at Rails and I've seem similar problems, but I can't solve mine. My routes: resources :users do resources :items end My models: class Item < ActiveRecord::Base belongs_to :user end class User < ActiveRecord::Base has_many…
letz
  • 1,762
  • 1
  • 20
  • 40
52
votes
4 answers

How can you access RouteData from the code-behind?

When using ASP.Net routing, how can you get the RouteData from the code-behind? I know you can get it from the GetHttpHander method of the RouteHandler (you get handed the RequestContext), but can you get this from the code-behind? Is there anything…
Deane
  • 8,269
  • 12
  • 58
  • 108
52
votes
8 answers

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

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.
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
52
votes
7 answers

Rails routes: GET without param :id

I'm developing a REST API based on rails. To use this API, you MUST be logged in. Regarding that, I'd like to create a method me in my user controller that will return a JSON of the logged in user infos. So, I don't need an :id to be passed in the…
Gozup
  • 1,005
  • 2
  • 10
  • 20
51
votes
8 answers

Using HTML anchor link fragment in Angular 6

I am working with an Angular 6 project in which I have disabled/removed hash-location-strategy which removes # from URL. due to this change the link having:
  • Contact Settings
  • Suresh Karia
    • 17,550
    • 18
    • 67
    • 85