Click here to Skip to main content
15,893,381 members
Everything / Routing

Routing

routing

Great Reads

by Tomáš Růt
Simple explanation of bobril routing mechanism
by Houssem_Dellai
Creating a Web API service that gets tweets and hosting it on Windows Azure.
by ASP.NET Community
MVC routingIn ASP.NET MVC 3 one of the main parts is routing. The routing is helps to map the particular view and particular controller.When we
by Shahriar Hossain
Learn how to do A/B testing in Azure

Latest Articles

by Syed Zain Shah
This article tells you about the convention-based Routing and Attribute Routing in detail. Feel free to give your feedback.
by Tomáš Růt
Simple explanation of bobril routing mechanism
by Shahriar Hossain
Learn how to do A/B testing in Azure
by pravin kambari
I am going to explore Routing in AngularJS and call a WCF service from AngularJS by creating common factory with $http service

All Articles

Sort by Updated

Routing 

19 Sep 2022 by Member 15064765
I am migrating a project which contains hundreds of static htm files all of which need to be routed to new dynamic Blazor pages. This website is decades old and has many hundreds (if not thousands) of backlinks that should not be sacrificed with...
19 Sep 2022 by Member 15064765
Just figured it out! Adding this endpoint to my Startup.cs gives me access to everything I need: endpoints.MapFallbackToPage("/{param?}", "/_Host"); For those that are 100% new, here is a more complete code snippet: ...
31 Jan 2022 by Sanjeev236
I am developing a blog Website in asp.net c# Webform(https://[DELETED].in). I am using using System.Web.Routing & Microsoft.AspNet.FriendlyUrls for routing in webform; Route.Config is as follows: var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode =...
31 Jan 2022 by Jamil Hallal
I would suggest to use URL Rewrite in IIS, this can be done in the web.config
24 Sep 2021 by r043
I have 2 page first one is customer list page and second is customer page. from the home page search we got customer list page and from customer list page we go to the customer page, but when we search customer from home page will go on the...
31 Jul 2021 by kowsalya salem
In my Website I'm integrated with firebase real time database and fire store Document Database, It Loading large amount of data for analysis same by default on every page view. if some one intently Programmatically creating Multiple time of...
19 Oct 2020 by thabet idris
I have three levels of route attribute inheritance : ClassA : ClassB public string Concat(..) [Route(..)] ClassB : ClassC [Route(..)] ClasseC: ControllerBase The problem is that service "Concact" in the ClasseA never working ! Here is my code...
26 Jun 2020 by Patrice T
You do not even asked a question. You show no attempt to solve the problem yourself, your main effort is pasting the requirement, you just want us to do your HomeWork. We do not do your HomeWork. HomeWork is not set to test your skills at...
26 Jun 2020 by OriginalGriff
I suggest you talk to your classmate: How can I send numbers to a specific buffer every time[^] And I'll give you the same answer: Quote: We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all...
6 Dec 2019 by Devrim Altınkurt
All routing examples are using with '/' character for example: /{category}/{product}/{id} /computer/mainboard/13 is it possible use a comma ',' instead of '/' for example: /{category},{product},{id} /computer,mainboard,13 thanks What I have tried: in startup.cs public void...
6 Dec 2019 by Richard Deeming
According to this StackOverflow thread[^], that should work providing that all parameters are specified. However, it's not a widely used URL format, and it's not recommended.
26 Nov 2019 by Afzaal Ahmad Zeeshan
What you are looking for is to be done on the runtime, and these attributed at mapped at compile-time. You will not be able to modify them after your app has been built. One way to solve this would be to use a dynamic route and then process the actual URI on runtime and execute the...
26 Nov 2019 by Krishnananthan Vijayaretnam
Currently I'm working on an asp.net mvc project. I have done an attribute routing and it's working well. The code is given below. Now I'm thinking of keeping the Route values on a table and set it to relevant actions. For example currently for the action TestOne I've set "Test_Test_One" as a...
25 Aug 2019 by verma.vivek
I have needed to LOG any action perform by user. like: which routes he visit, button click, etc... Also, log the DateTime or visit routes. What I have tried: Handle requests with controllers in ASP.NET Core MVC | Microsoft Docs[^]
25 Aug 2019 by Benktesh Sharma
One option that can be used to automatically log those request/response is via middleware in .Net Core. An example implementation is available at Using Middleware to Log Requests and Responses in ASP.NET Core - Exception Not Found[^] .
25 Aug 2019 by Afzaal Ahmad Zeeshan
You are handling that with .NET Core or .NET framework? There are differences in how you might handle the requests and responses in both these frameworks. Since you already have tried something for .NET Core, Quote: which routes he visit This part of your application can be handled within the...
26 Feb 2019 by Noor Mahdi
Hi, Need help to know if this is possible in ASP.Net MVC5 I want to set up routing such that 1. www.myWebsite.com points to Home/Index and 2. www.myWebsite.com/2/3 points to Chapter/Index I have a HomeController with a parameterless Index action (which works fine with the default route...
26 Feb 2019 by Richard Deeming
Try adding constraints to your parameters: routes.MapRoute( name: "Chapter", url: "{chapterID}/{verseNumber}", defaults: new { controller = "Chapter", action = "Index", verseNumber = UrlParameter.Optional }, constraints: new { chapterID = @"\d+", verseNumber = @"\d*" } ); Make...
13 Nov 2018 by Dheerajs975
i have created one project and implemented Angular routing in it, but i am getting the below errors. do anyone have any suggestions abou why these errors occuers. Error: [$rootScope:infdig] http://errors.angularjs.org/1.2.16/$rootScope/infdig? What I have tried: i have tried this below...
12 Jul 2018 by Samira Radwan
Hello,I have an asp.net web form application and need to add url routing.Had followed MSDN[^].I have also added into web.config.always return HTTP Error 404.0 - Not Found I have looked on-line alot and tried all possible solutions...
12 Jul 2018 by Member 13909437
Did you ever find a solution? I have the same issue right now.
5 Jul 2018 by Jinto Jacob
You have some issue in routes Quote: route - controller/action {brand}-car-prices -> /PriceList/PricesByBrand (For example : "toyota-car-prices") {color}-{brand}-car-prices -> /PriceList/PricesByColorAndBrand {for example : "green-toyota-car-prices"} {modelyear}-car-prices ->...
5 Jul 2018 by kuyucakli
Hi. I have a problem with rouing in asp.net mvc. How can i redirect : route - controller/action {brand}-car-prices -> /PriceList/PricesByBrand (For example : "toyota-car-prices") {color}-{brand}-car-prices -> /PriceList/PricesByColorAndBrand {for example : "green-toyota-car-prices"}...
5 Jul 2018 by Kornfeld Eliyahu Peter
The order of routing rules is matter... The look for the rule will stop on the first fit... In most cases that means that longer rules (with the same opening) should come before the short one... So switch between your two rules...
18 Jun 2018 by Tony Girgenti
To fix this issue, I added this route to the Startup.cs file: routes.MapRoute( name: "token", template: "token", defaults: new { controller = "API", action = "GetAccessToken" });
18 Jun 2018 by Tony Girgenti
Hello, I have an Asp.Net 4.5.2 web application client that makes calls to a OAuth 2.0 application running on my server Core 2.0 website. It works without a problem. The problem is when it returns from an authorization call to the server, it does not execute the return method specified in the...
16 Jun 2018 by Mehdi Gholam
Read the following : Authenticate with OAuth 2.0 in ASP.NET Core 2.0 • Jerrie Pelser's Blog[^]
30 May 2018 by Syed Zain Shah
This article tells you about the convention-based Routing and Attribute Routing in detail. Feel free to give your feedback.
3 May 2018 by QMasters
I have a problem to make a decision for putting Category/Path on URL Routing. Assume I have some products in my sample Web Application those attached to some categories. For example: Book1 Attached to -> Category1 | Category2 Book2 Attached to -> Category1 | Category2 | Category3 ...
20 Apr 2018 by Ger Hayden
Now Im thinking of introucing a new lead parameter called "journeySelectors". The value of "journeySelectors" will be interrogated to decide what of the four driving parameters have values need to be handled. "journeySelectors" will follow the example of "enDays" here from github
20 Apr 2018 by Ger Hayden
I have four dropdowns each in its own viewcomponent. I dont want to impose an order on how the user select from them - each one will filter the contents of the other three and the perspective of the user will govern which one they start from. Taken in order the route would be: ...
27 Dec 2017 by Member 13596834
Among all of the nodes in the RPL dodag, one of them will select the worst parent as its preferred parent i.e. the node wont follow the objective function to select the best one as the other nodes. Ans then it will update the parent set and again selects the worst one and keeps doing so over and...
27 Dec 2017 by Richard MacCutchan
If you do not understand their product then try one of the relevant sites for documentation and/or help forums: Contiki and Cooja - Google Search[^].
6 Sep 2017 by dilzz
Dear Experts, I have a question regarding the usage of ajax post call while using the MapPageRoute code in global.asax . I'll show you some example that i have used. In the Global.asax File Code looks like this. protected void Application_Start(object sender, EventArgs e) { ...
6 Sep 2017 by koklimabc
In markup view/fontend page, Have you put every your $.ajax inside $(document).ready(function(){ $.ajax({}); }) for automatic calling or event binding to control that said. one more things i check out this is mistakes url: "InitialClaimReport/populate_User", Do not put "" (double...
13 Aug 2017 by Tomáš Růt
Simple explanation of bobril routing mechanism
3 Aug 2017 by Member 12658724
I have the routes. public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("SurveySubmitRoute", "Survey/Submit", defaults: new {action = "Submit", controller =...
3 Aug 2017 by Kornfeld Eliyahu Peter
"Survey/Language{languageName}...
22 Mar 2017 by User 4180254
Could you try below -//Global.asaxprotected void Application_Start(object sender, EventArgs e){ RegisterRoutes(RouteTable.Routes);}public void RegisterRoutes(RouteCollection routes){ routes.MapPageRoute("IC", "IC", "~/Page1.aspx");}Have your link as -...
9 Feb 2017 by cgprakash
I came across an error on getting the url meta data by using Angular JS with ajax. The error statement is:XMLHttpRequest cannot load http://www.esample.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.var...
9 Feb 2017 by Richard Deeming
The code from the blog post you linked to needs to be used on the remote server being requested, not in the client making the request.The cross-origin restrictions are there to prevent malicious code from making unauthorised requests to remote resource. If it was possible for the client to...
8 Feb 2017 by cgprakash
But i have tried on my own web page its not restricted to get those details when I tried the same with php I got those details by curl functions.
8 Feb 2017 by F-ES Sitecore
The site you are trying to access doesn't want you accessing it from your own javascript, there is nothing you can do about this.
7 Nov 2016 by Member 12824529
I have autogenerated MVC set; and in this particular case, I'm utilizing only the Details and Edit view pages, as the id is determined elsewhere and create, delete, and index are all not applicable. Consequently, I have a different controller directly invoking the Details page with the id and...
7 Nov 2016 by Passion4Code
Hello,If you are posting the form and saving, then after successfully saving, return the user to the Details page using the RedirectToAction method.Controller.RedirectToAction Method (System.Web.Mvc)[^]This will redirect the user and land the user to the desired page.Thanks
30 Sep 2016 by pykos
Hello im having a problem setting up a route in my web api 2 project. I cannot seem to be able to create this kind of route with attribute routing/api/{controller}/?object_id=5It allways comes bact as 404...If I type /api/{controller}/object?object_id=5 I get the results that I...
30 Sep 2016 by David_Wimbley
The way web API routes work is you need to addconfig.MapHttpAttributeRoutes();To your WebApiConfig.cs file if it isn't there.Then as for the route you have two attributes to keep in mind, RoutePrefix and Route.So an example of this would...
19 Jul 2016 by Pedro Luis Gil Mora
Since script can't be loaded inside templates, due to Angular's jQLite wasn't written to achieve it, I decided to add jQuery library before Angular since it checks for jQuery existence, and voila!, it works. But, the fact that I'm here asking a question, means that there's a 'but', so, the...
18 Jul 2016 by Member 11376647
insted of this url : www.mysite.com/Home/Loginhome is the controller Login is the action .I add string before the controller :www.mysite.com/MyClub/Home/Loginand for example when i type: www.mysite.com/MyClub/Home/HomePageat first its goes to HomePage but after it goes to also to...
18 Jul 2016 by Vignesh Mani
HI Friend,You are using extra one in your routing "{club}" so wherever you redirect from one controller to another controller or one page to another page you use club in you redirection in your MVC Project.
17 Jul 2016 by Kornfeld Eliyahu Peter
From the point of view of the mapper, these two mappings are the same, so everything that fits the second also fits the first and therefore you never will be redirected to the second...Try something like this:Private Shared Sub RegisterRoutes(routes As RouteCollection) ...
17 Jul 2016 by SuRaj Dedhia
I have website developed in vb.net. I have many pages which is template based means structure is same just according to parameters it's page name & content gets changed. So I have define routing in my global.asax file. Problem is it is working only for one page which is on top. in following...
6 Jul 2016 by Abhijit Parab
I have 2 App servers where I have hosted two websites. both applications are running on different port.Now I want to configure ARR server which will route request to these two APP servers. How can I configure APP servers on ARR with different Port in same server Farm ?For example...
29 Apr 2016 by EasyHero
hi, i noticed that when i view my html pagesource i see my javascript references and when i click on them, i could see all my javascript code. please how to i restrict users from viewing my javascript code when they click on the link in the page source. i'm coding with mvc5.What I have...
29 Apr 2016 by Richard Deeming
You don't.In order for the browser to execute your script, it has to be able to download your script. If you prevent the user from downloading your script, then your prevent the browser from executing your script, and you break your site.Any operation which needs to be kept secret should...
27 Jan 2016 by Ray Wampler
Yes, the problem was that we had an old build script for a classic ASP.Net app and so it was not publishing the Views and Areas folders. Once we had all the .cshtml files on the server it worked fine.
6 Jan 2016 by Mohsen.srn
ok, the problem solved by myself. public ActionResult singleQuestion(int id, string slug) { var questions = BQcnt.Questions; var showQuestion = questions.Find(id); if (showQuestion != null) { var...
5 Jan 2016 by Mohsen.srn
I am trying to make my websites urls more SEO friendly, so I Used This approach to change routing.(although I dont know is this approach is Best Way or not - but this is not my Question!)public static void RegisterRoutes(RouteCollection routes) { ...
2 Dec 2015 by Member 11545705
I am using autocomplete extender for getting suggestions in .aspx page it was working fine and when i have routed the URL it was not working properly and some times it's not responding.In the routed url all html content is displaying letter by letter Suggestions what iam getting in routed...
18 Oct 2015 by Sanjith S
which is the suitable algorithm for spatial Routing in sql server 2012??i just heard about brute force algorithm and a*..which one gives an optimum solution?and their difference...and how to find the shortest path in sqlserver(Codes and steps)
13 Oct 2015 by Krunal Rohit
As I can see from you code, you have created different routes for your each action.And pity that you've updated the default route too.So now if you want to add one new action, you have to create the new route for that. Something like this:routes.MapRoute( "Comment", ...
13 Oct 2015 by FoxRoot
I have a project that serves some blog data and pictures. I created controllers and also actions for both blog and pictures. I updated Global.asax.cs to create user friendly urls. No problem till here. Now I want to add a simple controller which is Comment and an action which is...
6 Oct 2015 by Ray Wampler
I have a .Net 4.5 Web API 2 application that runs fine locally through Visual Studio on IIS Express but does not run when deployed to a server.The deployed server is 2008 R2 SP1 with IIS 7.5 and .Net 4.5.2 installed.On the deployed website when I go to the root instead of showing the...
13 Sep 2015 by F-ES Sitecore
You can use the FormCollection to process the post dynamicallyGetting Data From View to Controller in MVC[^]
13 Sep 2015 by Member 9683318
Hi, Below is my business scenario and I am trying to identify the best possible solution to address itBusiness ProblemI have an upstream system which invokes my MVC application. The parameters are passed through a HttpPost rather than parameterized URL.Possible Solution ?1)...
16 Aug 2015 by Shahriar Hossain
Learn how to do A/B testing in Azure
9 Aug 2015 by jyoti mahalik
Hi,I have implemented ARR reverse routing in IIS 8.5 ...
30 Jul 2015 by Alan Balkany
My controller action with two parameters is never called. Can anyone see what I'm doing wrong?URL: /api/JobTitle/1/55 (The arguments are 1 and 55.)ROUTE: config.Routes.MapHttpRoute( name: "With2Ids", routeTemplate: ...
23 Jul 2015 by pravin kambari
I am going to explore Routing in AngularJS and call a WCF service from AngularJS by creating common factory with $http service
22 Jul 2015 by ThatOneG3Y3
Hi, I've been looking all over the net looking for a tutorial or code snippets that would point me in the direction or to give me some direction on how to set up my WebApi 2 to expose it's methods through port forwarded internet router. Can anyone help me out with this? Thanks in advance.
15 Jul 2015 by Sergey Alexandrovich Kryukov
Please see: https://msdn.microsoft.com/en-us/library/cc668201(v=vs.140).aspx[^] and URL Routing with ASP.NET 4.0[^].—SA
7 Jun 2015 by aspdotnetkhan
Hi,This below code snippet working with SQL query i wrote in code behind.' NavigateUrl=''> ...
27 May 2015 by Shivachalappa Gotur
Hi, have you modified the webconfig file as shown, in dotnetguts.http://dotnetguts.blogspot.ae/2008/07/url-rewriting-with-urlrewriternet.htmlPlease modify it as shown and try.
27 May 2015 by aspdotnetkhan
Hi,I am using 'Intelligencia UrlRewriter' it is working fine in local server but on godaddy server it is showing error.website hosted on godaddy. http://fzkforum.com/bscore/http://fzkforum.com/rome-the-worlds-first-superpower-17.aspxWINDOWS, Asp.net 4.0/4.5 and ISIS 7 are...
26 May 2015 by Sander Rossel
The fourth in a series on MEAN web development.
20 May 2015 by Member 11705500
I want to implement IP.Board (which is a forum application: http://www.invisionpower.com/apps/board/) in Zend, but it's not a module, it has its own code and runs by itself. How can I make a route to that directory, so it can just start functioning on its own?I plan to put the forum into a...
19 May 2015 by SahilKataria
So, here are my requirements. I am building a multi-tenant site where companies after they sign up get their own subdomain. Assume that my business is called Email Jobs Inc with domain www.emailjobs.com. This site is hosted in a shared ISP environment so I have very limited access to IIS...
10 May 2015 by talebi2109
HiI am on a project which includes different nodes one node is source of the stream and another sink of that stream and there are some intermediate nodes between them. i have these assumptions:1. each node can ping the neighbor one 2. but there is no guarantee that this is possible for...
7 May 2015 by exoc
Hi!I'm searching for help for my current asp.net project. What I'm trying to do is this:The user should be able to use this url"http://domain.tld/page/param1" where page is my asp.net page and param1 is a changing parameterand he should be routed/mapped...
22 Feb 2015 by RajeeshMenoth
Hi,Ref :Routing in MVC
22 Feb 2015 by Pravesh Singh
I’m working on url routingI want to redirect page without change url.When type url www.example.com/Default.aspx that time url show as same but return page Home/Index (Controller/Action)I want to redirect page with actual url.And second require is when type...
16 Feb 2015 by Jeroen E
There were two problems with this as it turns out:First:My web.config was not properly set up to handle a dot in the URL.So I changed it to this: verb="*" type="System.Web.Handlers.TransferRequestHandler" ...
16 Feb 2015 by Kornfeld Eliyahu Peter
Namespace is irrelevant here...All you have to do is include the area name in your link...@Html.ActionLink("Action", "Controller", "ActionName", new { area = "Area" })
16 Feb 2015 by Sri Nivas.M
Solved this by using the following...
16 Feb 2015 by Sri Nivas.M
I have 3 web api controllers in one project.One is at root level and remaining two are in two different areas.How to route them ?
13 Feb 2015 by Mike Hankey
It turns out I had used the UserViewModel on the _Layout page to fill in some user information and it appears that the _layout view model trumps all other down the chain. Which I guess makes sense but once I changed it everything fell into place.
13 Feb 2015 by Mike Hankey
I may just tired, frustrated and grabbing at straws but here goes.I tried using Areas in my MVC Web app and was running into issues with resolving paths so I moved my admin page back in to the main area.When I did the Admin controller gets called which in turn invokes the Admin/Index...
10 Feb 2015 by Jeroen E
From an MVVM application I get the following URL for delete: http://localhost/Recruiters/Addresses(guid '7777-777')/CIP.Domain.AddressesI did not fill complete guid in the example URL, but it is a valid one.This URL is not a normal OData route, so I created an routing...
10 Feb 2015 by harsimranb
An angular application that consumes GitHub, primarily to demonstrate the use of angular-loading-bar and ui-router to give better feedback during longer requests.
16 Sep 2014 by dedamu
Hi,We are using Asp.net Webforms Framework 4.0.We added routing, previously we were sending data in httpcontext and server.transfer.We are sending 6 set of values to another page.How do we send these data to another page? Best Regards,Damodar
15 Sep 2014 by Member 11083257
I am using Kendo TabStrip for loading my partial views.But found problems in maintaing urls for different ajax requests for actions in controllers.Here is some code to make it more clear:In my _layout.cshtml view: @(Html.Kendo() .Menu() .Name("HQmenu") ...
18 Jul 2014 by sheryi26
Hi,I am working on a news website, Asp.net 4.0 C#I want to perform URL Rewriting, I read many pages and did its instructions, but it has not been working properly!It is my main URL: http://news.ariavid.com/articles.aspx?id=3I wrote these codes in Global.asax:add this...
18 May 2014 by Shahriar Hossain
[Attribute] Routing in ASP.NET MVC 5 / WebAPI 2
10 Apr 2014 by Member 10412237
Given two firewalls,one border router, one layer 3 switch and two routers, how can i design asecure network required to support two functional units of my organisation(all in the same site)My organisation hosts a web server and has an e-mail server. Also the employees can connect to the...
10 Apr 2014 by Michal Zubek
Hello,I would like to have many instances of the same service at the server.Unfortunately, I cannot use multi-threads (3rd party dll's does not support multi-thread)I thought to have some kind of router/switch which will get request from the client and depend on the occupancy of...
20 Mar 2014 by mrityunjay3601
protected void lnkForward_Click(object sender, EventArgs e) { try {string UserName=Session["UserName"].ToString();string url = "~/Page2/" +UserName;Response.Redirect(url, false); } catch (Exception) { throw; } }in Web.config
20 Mar 2014 by mrityunjay3601
I Have one page Default.aspx , i want to pass Query string with the url.But i want URL should come in a appropriate format.protected void lnkForward_Click(object sender, EventArgs e) { try { string UserName=Session["UserName"].ToString(); string...
20 Mar 2014 by Er. Ajay Chauhan
According to me, you can find this functionality in MVC application.