369 questions
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
/...
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 ...
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}&...
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> ...
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 ...
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 ...
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 ...
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 ...
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&...
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 &...
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(...
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 ...
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 ...
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 ...
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 ...