Questions tagged [asp.net-mvc-routing]

Questions about routing within ASP.NET (including MVC).

The ASP.NET Routing module is responsible for mapping incoming browser requests to particular ASP.NET handlers. It is commonly used to map ASP.NET MVC controller actions, but routing is also used with ASP.NET Web Forms, ASP.NET Web API, route attribute (Web API2) and custom handlers.

Learn more about ASP.NET Routing on MSDN

4131 questions
1
vote
1 answer

MVC 3 unit testing controller but GetVirtualPathData sends strange VirtualPathData results

I'm encountering a strange behaviour when unit testing controller. I'm using some extension methods for building Url.Action and all works well when runing code in production but the unit test fails. In fact my custom Url.Action helper is using the…
1
vote
1 answer

Source not found - RouteProvider not found

I'm seeing a typical issue. From Register custom routes, I'm calling controller method like this: protected override void RegisterCustomRoutes(RouteCollection rots, IProuteProvider rotProvider) { rotProvider.MapRoute(rots,null,…
AskMe
  • 2,495
  • 8
  • 49
  • 102
1
vote
1 answer

Getting Microsoft.AspNetCore.Hosting.Diagnostics[6] Application startup exception in .NET Core 3

I am getting below error while running Web API Application with .NET Core 3.0. I have implemented Attribute Routing and using the below code in Configure method of statup.cs app.UseEndpoints(endpoints => { …
Dilip
  • 191
  • 4
  • 17
1
vote
1 answer

The controller path for '/null' was not found or does not implement IController

I have existing asp.net web forms applications that I have added RouteConfig.RegisterRoutes(RouteTable.Routes); to their global.asax files. I'm attempting to use some MVC alongside the forms - like friendly urls. The code is pretty standard and…
Barry Franklin
  • 1,781
  • 1
  • 27
  • 45
1
vote
1 answer

MVC routing issue

Currently I'am working on an MVC project in which I try to get a kind of dynamic routing working. My idea would be that i left the original route in the global.asax.cs, so this one will take care of every controller I make. For example the Contact…
ChristiaanV
  • 5,401
  • 3
  • 32
  • 42
1
vote
1 answer

Nasty interaction between ASP.NET MVC Routing and my login system

I am developing an ASP.NET MVC application that has two kind of pages: (1) a login page, and (2) everything else. Even my home page displays content that requires authorized access: public class HomeController : Controller { [CustomAuthorize] //…
isekaijin
  • 19,076
  • 18
  • 85
  • 153
1
vote
1 answer

How can I add an alternative route to a controller method in MVC Core to support a legacy endpoint

The following code I am trying is changing the route so that it is only accessible via [Area]/[Controller]/DailyStatusSummary - is there any way to just add it as an alternative route? [HttpGet("[Area]/[Controller]/DailyStatusSummary")] …
egmfrs
  • 1,272
  • 3
  • 17
  • 31
1
vote
2 answers

DNN Cannot access POST method in DNN Api Controller

My GET method WORKS fine when I use the url logged in as SuperUser like this(I get the name of the first user pulled from the DB): http://localhost/DesktopModules/AAAA_MyChatServer/API/ChatApi/GetMessage But I cannot access the POST method in the…
1
vote
1 answer

Area endpoint routing in asp.net core 3.1

this is a simple question and im just asking out of curiosity ive set up endpoint routing to area as such: app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", …
toy
  • 422
  • 1
  • 7
  • 19
1
vote
0 answers

something like modules in orchard project

As you know, in ASP.NET MVC you can use Areas to categories your application and make it easy to manage and organize your logic.Say if I have controller named "Teams" and action named "Create", which is located in "Fun" Area, then I can request the…
1
vote
1 answer

Attribute routing with default root parameter in WebAPI

I have an API where all methods need a fixed parameter {customer} : /cust/{customerId}/purchases /cust/{customerId}/invoices /cust/{customerId}/whatever* How can I map all controllers to receive this parameter by default in a reusable way…
1
vote
1 answer

ASP.NET Core 3.0 change default endpoint route with attribute routing

App is on ASP.NET Core, we recently migrated to 3.0. I need to navigate to mycontroller/login, so login action instead of default index action but struggle with changing the default controller action method. I keep getting my index page, only when I…
unknown
  • 461
  • 9
  • 23
1
vote
1 answer

Custom route is not hitting in asp.net core mvc?

I have sample .net core mvc application, im testing SEO friendly url creating , which is posted Here I have created all the code as in the post. My testing controller action is as follows public IActionResult Index(int id, string titl) { …
Roshan
  • 3,236
  • 10
  • 41
  • 63
1
vote
1 answer

creating more then one route in asp.net mvc

i am trying to create routes in asp.net mvc routes.MapRoute( "Localization", // Route name "{Culture}/{controller}/{action}/{id}", // URL with parameters new { Culture = "en-US", controller = "Home", action = "Index", id…
Usman Masood
  • 1,937
  • 2
  • 17
  • 33
1
vote
2 answers

Serving dynamic XML file from .NET Core Web Application

In my .NET Core 2.2 website, I have a controller method within my BlogController that generates a sitemap.xml file: public ActionResult SiteMap() { // logic here return Content("...", "text/xml"); } I have this route…
1 2 3
99
100