Questions tagged [url-routing]

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

url-routing
Filter by
Sorted by
Tagged with
413 votes
6 answers
333k views

Getting full URL of action in ASP.NET MVC [duplicate]

Is there a built-in way of getting the full URL of an action? I am looking for something like GetFullUrl("Action", "Controller") that would return something like http://www.fred.com/Controller/Action....
Alan Spark's user avatar
  • 8,202
248 votes
19 answers
683k views

Vue.js redirection to another page

I'd like to make a redirection in Vue.js similar to the vanilla javascript window.location.href = 'some_url' How could I achieve this in Vue.js?
Jimmy Obonyo Abor's user avatar
223 votes
12 answers
174k views

Multiple path names for a same component in React Router

I am using the same component for three different routes: <Router> <Route path="/home" component={Home} /> <Route path="/users" component={Home} /> <Route path="/...
Chetan Garg's user avatar
  • 2,247
117 votes
2 answers
80k views

Client Routing (using react-router) and Server-Side Routing

I have been thinking and I am confused with the routing between Client and Server. Suppose I use ReactJS for server-side rendering before sending the request back to web browser, and use react-router ...
heartmon's user avatar
  • 1,421
113 votes
1 answer
87k views

React-Router : What is the purpose of IndexRoute?

I don't understand what the purpose of using an IndexRoute and IndexLink. It seems that in any case the code below would have selected the Home component first unless the About path was activated. <...
Nick Pineda's user avatar
  • 6,414
110 votes
2 answers
83k views

Difference between $state.transitionTo() and $state.go() in Angular ui-router

In AngularJS, I see sometimes we use $state.transitionTo() and sometimes we use $state.go(). Can anyone tell me how they differ and when one should be used over the other?
Barcelona's user avatar
  • 2,132
88 votes
7 answers
160k views

AngularJS dynamic routing

I currently have an AngularJS application with routing built in. It works and everything is ok. My app.js file looks like this: angular.module('myapp', ['myapp.filters', 'myapp.services', 'myapp....
Greg's user avatar
  • 31.2k
80 votes
6 answers
26k views

ASP.NET MVC Routing Via Method Attributes [closed]

In the StackOverflow Podcast #54, Jeff mentions they register their URL routes in the StackOverflow codebase via an attribute above the method that handles the route. Sounds like a good concept (with ...
TorgoGuy's user avatar
  • 1,326
78 votes
5 answers
81k views

Using ASP.NET routing to serve static files

Can ASP.Net routing (not MVC) be used to serve static files? Say I want to route http://domain.tld/static/picture.jpg to http://domain.tld/a/b/c/picture.jpg and I want to do it dynamically in the ...
Martin Liversage's user avatar
76 votes
8 answers
46k views

Flask url_for generating http URL instead of https

I am using url_for to generate a redirect URL when a user has logged out: return redirect(url_for('.index', _external=True)) However, when I changed the page to a https connection, the url_for still ...
Blaise's user avatar
  • 7,368
73 votes
4 answers
202k views

RegEx to match stuff between parentheses

I'm having a tough time getting this to work. I have a string like: something/([0-9])/([a-z]) And I need regex or a method of getting each match between the parentheses and return an array of ...
Oscar Godson's user avatar
  • 32.3k
71 votes
3 answers
56k views

Express routes parameter conditions

I have a route on my Express app that looks like this: app.get('/:id', function (request, response) { … }); The ID will always be a number. However, at the moment this route is matching other ...
user avatar
65 votes
2 answers
41k views

Flask URL Route: Route Several URLs to the same function

I am working with Flask 0.9. Now I want to route three urls to the same function: /item/<int:appitemid> /item/<int:appitemid>/ /item/<int:appitemid>/<anything can be here> ...
Gaby Solis's user avatar
  • 2,497
60 votes
6 answers
72k views

Organize routes in Node.js

I start to look at Node.js. Also I'm using Express. And I have a question - how can I organize web application routes? All examples just put all this app.get/post/put() handlers in app.js and it works ...
NilColor's user avatar
  • 3,482
58 votes
7 answers
39k views

Difference between reverse() and reverse_lazy() in Django

I understand that we can use reverse() in FBV and reverse_lazy() in CBV. I understand that we have to use reverse_lazy() in CBV as the urls are not loaded when the file is imported (Ref: Reverse_lazy ...
RyuCoder's user avatar
  • 1,774
57 votes
9 answers
108k views

How can I reload the current page in Ruby on Rails?

I currently have a login popup in my header bar which is on every page in my website. I want to be able to reload the current page that the person is on after a successful login. How do I do this in ...
EverTheLearner's user avatar
55 votes
5 answers
23k views

How do I create multi-page applications with Meteor?

I am new to Javascript and just started fiddling around with Meteor out of curiosity. What really surprises me, is that it seems that all HTML content gets combined into a single page. I suspect ...
Marcus Riemer's user avatar
55 votes
9 answers
50k views

url with multiple forward slashes, does it break anything?

http://example.com/something/somewhere//somehow/script.js Does the double slash break anything on the server side? I have a script that parses URLs and i was wondering if it would break anything (or ...
Joseph's user avatar
  • 119k
53 votes
4 answers
32k views

Why do I need to use http.StripPrefix to access my static files?

main.go package main import ( "net/http" ) func main() { http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) http.ListenAndServe(":8080", nil) } ...
Dante's user avatar
  • 11k
52 votes
4 answers
33k views

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 ...
Deane's user avatar
  • 8,447
52 votes
5 answers
111k views

AngularJS - Animate ng-view transitions

I have 2 html pages, welcome.html and login.html both of which are "inserted" into index.html dependending on the URL via an ngview attribute and router provider, as part of my AngularJS app. An ...
Greg's user avatar
  • 31.2k
51 votes
3 answers
67k views

ASP.NET MVC URL Routing with Multiple Route Values

I am having trouble with Html.ActionLink when I have a route that takes more than one parameter. For example, given the following routes defined in my Global.asax file: routes.MapRoute( "Default",...
Ian Oxley's user avatar
  • 11k
50 votes
6 answers
83k views

Rails Routing (root :to => ...)

I know how to set the routes root of my rails app to a controller and an action. But how to add an id? /pages/show/1 should be the root. How do I set this?
Joern Akkermann's user avatar
50 votes
4 answers
41k views

Preferred client side routing solution? [closed]

I am designing a one page browser based web application. JQuery is already being used in my application. I am currently planning to use KnockoutJS for data-binding and UI management. However I have ...
lorefnon's user avatar
  • 13k
48 votes
5 answers
102k views

Using routes in Express-js

So I'm starting to use Node.js. I saw the video with Ryan Dahl on Nodejs.org and heard he recommended Express-js for websites. I downloaded the latest version of Express, and began to code. I have a ...
Andreas Stokholm's user avatar
47 votes
1 answer
12k views

Angular2 router VS ui-router-ng2 VS ngrx router

What are the benefits and disadvantages of using ui-router-ng2 instead of the new Angular2 router? In the past i used ui-router with Angular 1.x instead of using ngRoute, because i need better support ...
smartmouse's user avatar
43 votes
5 answers
25k views

Flask and React routing

I'm building the Flask app with React, I ended up having a problem with routing. The backend is responsible to be an API, hence some routes look like: @app.route('/api/v1/do-something/', methods=["...
knowbody's user avatar
  • 8,226
42 votes
5 answers
37k views

Rails: redirect all unknown routes to root_url

Whenever a user hits the wrong page, rails shows 404.html from the public folder. However, I'd like just to redirect the browser to the root page, without showing anything. So I tried globbing, but ...
Albus Dumbledore's user avatar
39 votes
5 answers
19k views

ASP.NET MVC Url Route supporting (dot)

I hope that you can help me with the below problem. I am using ASP.NET MVC 3 on IIS7 and would like my application to support username's with dots. Example: http://localhost/john.lee This is how my ...
Cindro's user avatar
  • 1,065
38 votes
3 answers
11k views

What's the difference between application- and router level- middleware when routing in Express?

In the Express docs, it says: Application level middleware are bound to an instance of express, using app.use() and app.VERB(). Router level middleware work just like application level middleware ...
dayuloli's user avatar
  • 16.7k
37 votes
1 answer
55k views

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: <input type="submit" class="btn btn-lg ...
anad2312's user avatar
  • 787
36 votes
7 answers
119k views

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 ...
Tartar's user avatar
  • 5,324
36 votes
2 answers
28k views

What is the difference between URL Router and Dispatcher?

I want to know the difference between a URL Router and a Dispatcher. What are they and what each of them do?
YakumaruBR's user avatar
36 votes
3 answers
11k views

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's user avatar
  • 74.9k
36 votes
5 answers
55k views

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 ...
smartmouse's user avatar
35 votes
9 answers
17k views

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. ...
John's user avatar
  • 30.1k
35 votes
4 answers
18k views

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's user avatar
  • 2,395
34 votes
4 answers
53k views

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<pk>\d+)/$', views.PerfRunView.as_view( )) The problem is, I cannot figure out how I can access 'pk'...
Luke's user avatar
  • 2,476
33 votes
10 answers
33k views

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's user avatar
  • 20.9k
33 votes
2 answers
11k views

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....
stej's user avatar
  • 29.1k
33 votes
2 answers
4k views

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'...
Tom Anderson's user avatar
  • 10.8k
33 votes
1 answer
20k views

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....
Nick Pineda's user avatar
  • 6,414
32 votes
5 answers
35k views

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 ...
Michael Low's user avatar
  • 24.4k
31 votes
3 answers
20k views

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 ...
31 votes
7 answers
45k views

Relative URL in JQuery Post Call

I have the following situation. I developed my first MVC Asp.Net application. it runs on my server at the following adress http://localhost:59441/ I wrote some JQuery Post Methods that looked like ...
SerenityNow's user avatar
  • 1,065
31 votes
4 answers
26k views

Discovering Generic Controllers in ASP.NET Core

I am trying to create a generic controller like this: [Route("api/[controller]")] public class OrdersController<T> : Controller where T : IOrder { [HttpPost("{orderType}")] public async ...
Brent Arias's user avatar
  • 29.7k
30 votes
6 answers
31k views

Add a trailing slash at the end of each url?

I have a little problem here. I need to add a trailing slash at the end of each url in the site I'm working on. I defined all the links inside the site to have a trailing slash like so: <a href="...
Ahmed's user avatar
  • 11.3k
30 votes
3 answers
29k views

Clearing URL hash

Visit stackoverflow.com/#_=_ and window.location.hash evaluates to #_=_. Fine. Now execute window.location.hash = '' to clear the hash, and the URL becomes stackoverflow.com/#. (Notice the trailing #....
Randomblue's user avatar
  • 114k
30 votes
2 answers
21k views

How to get RouteData by URL?

I need to get RoutData by given URL string in ASP.NET MVC application. I've found the way that I need to mock HttpContextBase based on my URL string and then pass it to RouteTable.Routes.GetRouteData(...
Serge S.'s user avatar
  • 4,885
28 votes
5 answers
15k views

What is routing? Why is "routing" needed in single page web apps?

I understood that routing libraries for SPAs like https://github.com/ReactTraining/react-router help to parse the URL and put the app into a corresponding state of a state machine. Is there more to ...
jhegedus's user avatar
  • 20.5k

1
2 3 4 5
103