Questions tagged [url-routing]

URL routing is the process of mapping a URL to its content.

5061 questions
37
votes
1 answer

AngularJS - How do I change the State from Inside the Controller

I am new to AngularJS and would like to know how I change the State from within the Controller. For example, I typically change the state on a button click:
anad2312
  • 787
  • 2
  • 8
  • 20
36
votes
5 answers

Angular2 router: how to correctly load children modules with their own routing rules

here is my Angular2 app structure: Here is part of my code. The following is the main module of the Angular2 app, that imports its routing rules and a child module (EdgeModule) and uses some components related to some…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
36
votes
7 answers

Laravel 5 check whether a user is logged in

I am new to Laravel 5 and trying to understand its Auth process. I want to prevent user to reach some of my pages unless the user is not logged in. Trying to make it with Route:filter but it does not work. What i have done wrong…
Tartar
  • 5,149
  • 16
  • 63
  • 104
36
votes
3 answers

ASP.NET URL Rewriting

How do I rewrite a URL in ASP.NET? I would like users to be able to go to http://www.website.com/users/smith instead of http://www.website.com/?user=smith
GateKiller
  • 74,180
  • 73
  • 171
  • 204
35
votes
9 answers

ASP.net MVC support for URL's with hyphens

Is there an easy way to get the MvcRouteHandler to convert all hyphens in the action and controller sections of an incoming URL to underscores as hyphens are not supported in method or class names. This would be so that I could support such…
John
  • 29,788
  • 18
  • 89
  • 130
35
votes
2 answers

What is the difference between URL Router and Dispatcher?

I want to know the difference between the URL Router and Dispatcher, because searching on the internet has some interesting things, just do not know if it's because they are similar, or because they reverse the function of each. Can anyone tell me…
YakumaruBR
  • 351
  • 1
  • 4
  • 3
34
votes
4 answers

What is client-side routing and how is it used?

I will be glad if someone could answer the following questions How does it work? Why is it necessary? What does it improve?
Mithir
  • 2,355
  • 2
  • 25
  • 37
33
votes
10 answers

How do I get Route name from RouteData?

I have several routes defined in my Global.asax; When I'm on a page I need to figure out what is the route name of the current route, because route name drives my site menu. How can this be done?
Andrey
  • 20,487
  • 26
  • 108
  • 176
33
votes
2 answers

How can I override a .svc file in my routing table?

I have this URL that was used from some JSON post back from the main website: http://site/Services/api.svc/UpdateItem We are in the process of updating the web site slowly to ASP.Net MVC 2 and don't want to break any current URL's in the system.…
Tom Anderson
  • 10,807
  • 3
  • 46
  • 63
33
votes
1 answer

react-router : run is not a function

A Egghead tutorial teaches it like this: var React = require('react'); var Router = require('react-router'); var routes = require('./config/routes'); Router.run(routes, function(Root){ React.render(,…
Nick Pineda
  • 6,354
  • 11
  • 46
  • 66
33
votes
4 answers

Accessing Primary Key from URL in Django View Class

I have a URL pattern mapped to a custom view class in my Django App, like so: url( r'^run/(?P\d+)/$', views.PerfRunView.as_view( )) The problem is, I cannot figure out how I can access 'pk' from the URL pattern string in my view class so that I…
Luke
  • 2,434
  • 9
  • 39
  • 64
33
votes
2 answers

How to defer routes definition in Angular.js?

I have configured some basic routes that are available for all users before they log in: App.config(function ($routeProvider) { $routeProvider. when('/login', { templateUrl: 'views/login.html', controller: PageStartCtrl.Controller }). …
stej
  • 28,745
  • 11
  • 71
  • 104
32
votes
5 answers

Can angularjs routes have default parameter values?

Can I set a default value of a parameter of a route in AngularJS? Is there a way to have /products/123 and /products/ handled by the same route ? I'm looking to refactor my existing code, which looks like: myModule.config(['$routeProvider',…
Michael Low
  • 24,276
  • 16
  • 82
  • 119
31
votes
3 answers

ASP.NET MVC custom routing for search

Here is my scenario. For the example lets say that I need to return a list of cars based on a search criteria. I would like to have a single View to display the results since the output will be the same, but I need several ways of getting there. …
Papa Burgundy
  • 6,397
  • 6
  • 42
  • 48
31
votes
4 answers

Discovering Generic Controllers in ASP.NET Core

I am trying to create a generic controller like this: [Route("api/[controller]")] public class OrdersController : Controller where T : IOrder { [HttpPost("{orderType}")] public async Task Create( [FromBody] Order
Brent Arias
  • 29,277
  • 40
  • 133
  • 234