Skip to main content
0 votes
1 answer
894 views

How to configure Yarp routes based on attribute routing

i want to user a reverse proxy for a project im working and i have decided to try yarp. Most if not all documentation on it uses catch-all on and that got me thinking how would i setup something like /...
John Major's user avatar
1 vote
1 answer
116 views

How to generate a URL with Attribute Routing based on the controller template and Action Template

I have the following URL template in the IdeasController: [Controller] [Route("/gemeente/{municipalityName}/election/{electionId}/ideas/"Name = "Ideas")] public class ...
Mendi Sterenfeld's user avatar
0 votes
1 answer
2k views

Routing: How to allow Path parameters and Query parameters at the same time?

For my ASP.NET Core 6.0 MVC web application, I need both: http://example.com/users/7 and http://example.com/users?userid=7 My current controller looks like this: [HttpGet("users/{userId}&...
Ingmar's user avatar
  • 1,487
0 votes
1 answer
205 views

Validate Route Parameter by Name across many endpoints

In a .NET 6 MVC app, I have a lot of endpoints attributed similar to: [HttpGet("getCustomerItem/{customerNumber:int}/{itemNumber:int}")] public async Task<IActionResult> ...
Jonesopolis's user avatar
  • 25.4k
1 vote
1 answer
2k views

Attribute Routing with Regex in Path in ASP.NET Core not working

I have the following code in my controller class [Route("movies/released/{{year}}/{{month:regex(\\d{2}):range(1,12)}}")] public ActionResult ByReleaseDate(int year, int month) { return ...
joekevinrayan96's user avatar
0 votes
1 answer
184 views

ASP.NET Core multi attribute routing

In my ASP.NET Core Web API application, I have declared a route with multiple attributes like following [HttpGet] [Route("{tenantId?}/user/getsettings/{id?}")] When I made a request from ...
ony19161's user avatar
0 votes
1 answer
509 views

Route that automatically gets name from webapi action

I have ApiController that looks like [RoutePrefix("Companies")] public class CompanyController : ApiController { [HttpGet] [Route("GetCompanyProfile")] public ...
Anders Lindén's user avatar
2 votes
1 answer
710 views

Web API partially (start with) match route in Controller

How can I map multiple urls to one action method? For example http://localhost:10000/api/ABC and http://localhost:10000/api/ABCDCD will map to same action name because both starts with ABC. I can't ...
user781700's user avatar
1 vote
4 answers
2k views

ASP.NET Core route attribute routing

My controller code looks like this: [Route("api/[controller]")] [ApiController] public class PaymentDetailController : ControllerBase { [HttpGet] public async Task<string&...
wajeeh rehman's user avatar
0 votes
3 answers
2k views

How to override Controller's name in asp.net mvc core?

In my MVC controller, i have two action methods which are rendering View, other 6 Action Methods are either HttpGet or HttpPost. I want to do the below for ActionMethods rendering View it will be &...
ispostback's user avatar
0 votes
1 answer
44 views

Asp.net core attribute route issue

I have this code: [Route("Users")] public class UserRegistrationController : Controller { [HttpGet("details/{userId}")] public async Task<IActionResult> UserDetails(...
leo's user avatar
  • 601
0 votes
1 answer
36 views

Lowercasing actions using Attribute Routing in MVC5

I am leveraging attribute routing in an MVC5 application and enjoy being able to declare conventions at the controller class level per the example below. For the actions within a controller, is there ...
Jakkwylde's user avatar
  • 1,302
2 votes
1 answer
2k views

How to do conditional routing in asp.net core?

I'd like to create routings like below [HttpPost("device/{id}/disable")] [HttpPost("device/{id}/enable")] public async Task SetDevice(stirng id, bool state) And when the user hit ...
sheepinwild's user avatar
0 votes
0 answers
368 views

.Net Core/MVC Mulit-Tenant Attritubute Routing using Areas with duplicate routes between different controllers

I am trying to create one .NET Core MVC app that serves up different content (that i defined as areas) based on the domain. I am using a constraint that will serve up the appropriate area based on the ...
user9871834's user avatar
10 votes
2 answers
8k views

How to set the default area in ASP.NET Core?

I am using areas in my ASP.NET Core 3.1 application (MVC). Now I want all requests without an explicit area to go to the "Main" area by default. This is how I currently set up my endpoint ...
Ingmar's user avatar
  • 1,487

15 30 50 per page
1
2 3 4 5
25