4,151 questions
0
votes
0
answers
36
views
How to configure ASP.NET MVC (.NET 4.8) app to work under /report location with Nginx?
I have an ASP.NET MVC application (on .NET 4.8). Currently, the DevOps team has set up Nginx to handle requests with: location: / and this works fine.
Now they want to change the setup so the ...
0
votes
1
answer
51
views
CatchAll Url redirect to HomePage not working in .NET 8.0
I'm using .NET 8.0 and I've added this line of code so that when the url is not found it can go back to the homepage but it's not working. Got several non-informative errors. I might be getting a ...
0
votes
0
answers
68
views
Routing with a suffix on the controller name
Given one or more controllers (within Areas), named for example CustomerController and OrderController, I would like to be able to route to them using either of the following at interchangeably...
/...
0
votes
1
answer
58
views
Mapped endpoint doesn't work when using attribute-routing ASP.NET
I hope you are doing OK, I have a project that I am updating and streamlining. BTW I am also learning .NET
I have the next problem, when I change this:
app.UseEndpoints(endpoints =>
{
endpoints....
2
votes
2
answers
75
views
How to get route value of action attribute in controller?
I have the action method defined like below:
[Route("example-page")]
public ActionResult MyAction()
{
// I want to use "example-page" in here, like a query parameter.
...
0
votes
1
answer
58
views
ASP.NET MVC the name of the area should not be a route
In my ASP.NET MVC project, I have areas that have a certain name like Admin but I'd like my route to use iAdmin.
For that I use the RegisterArea where I can specify my route, and it work well :
...
-1
votes
2
answers
489
views
.NET Core 6.0 Routing is Not working if i use areas
I have project with areas and normal controller in it. But Area routing is working but normal controller is not working.
Working, but Areas routing is returning 404 :
app.MapControllerRoute(
name: ...
4
votes
0
answers
140
views
Overload action method in ASP.NET Core 8 MVC based on type of http body
I want to write some API with single URL and want to route based on body type like below
[HttpPost]
[Route("{input: OverloadModelA}")]
public IActionResult OverloadInsert([...
1
vote
1
answer
221
views
ASP.NET Core API: Handling 404 Errors for Endpoints
I'm developing an ASP.NET Core API and facing an issue where the request to the api endpoint (/api/plants/search) consistently returns a 404 error, despite seemingly correct controller and routing ...
1
vote
2
answers
711
views
ASP.Net Core Web API URLs call gets rerouted to Angular project
I have a project in ASP.Net Core 8 and Angular 17 using Visual Studio 2022 version 17.9.0.
I am using the new "Angular and ASP.Net Core" project template. And I just have a stickler of a ...
0
votes
0
answers
569
views
How To Solve CreatedAtAction That Returns "No route matches the supplied values."
Hi folks I have a problem with using CreateAtAction in asp .net 8 api when I need to use it in my post or put request to go to a get request I have tried to make too many things to solve it by adding
...
1
vote
1
answer
57
views
ASP.NET MVC route by a city then controller and action
I have a basic ASP.NET MVC5 app with a Restaurant class as my model and I am currently using the default out of the box routing.
/Restaurant/Create
/Restaurant/Details
/Restaurant/Index
Previously ...
0
votes
2
answers
49
views
Page is not found:http://localhost:28196/About/Insert?area=Admin
When I try to post my Insert page for About Controller I am getting error as my title. I thougt that it is because of routing but I could not see any problem in my coding.
My routing as below.
...
0
votes
0
answers
297
views
Matching and Rebuilding URL Routes in ASP.NET Core
I'm working on an ASP.NET Core application where I have a default route template,
for example: ~/api/{area}/[controller]/{action?}/{id?}.
My goal is to match incoming URLs with other route templates ...
0
votes
1
answer
897
views
ASP.NET CORE - dynamically add a attribute route to an controller with [ApiController]
I'd like to have controllers with default Route URLs and HTTP method generated by custom code and not require any HttpPost|Get|etc attributes (route actions will default to Post). I can do this using ...
0
votes
1
answer
100
views
Apply different authorization policy on API depending on Http Method
I have an API developed in .NET7 with multiple controllers. Right now all the actions have the same authorization policy so we accomplished it by setting it up in the useendpoints middleware like ...
0
votes
1
answer
111
views
ASP.Net API & Core Search Functionality Issue
In my solution I have an ASP.NET Core Web API project. Skipping to the client side portion, in one of my controllers I am trying to implement a search function (my first time ever trying). When I try ...
1
vote
1
answer
106
views
Routes behaving weird after update from 3.1 to 6
I have updated an ASP.NET Core 3.1 MVC application to .NET 6, and now the routing is causing many "weird" problems.
This used to work:
<form asp-route="Resumes.Sections.SetTitle"...
0
votes
0
answers
59
views
ASP .NET MVC Routing matches controller from Area instead of looking only in root
I have a MVC project and it has controllers both outside and inside areas.
I have this rule in RouteConfig:
routes.MapRoute(
name: "Default",
url: "{...
0
votes
1
answer
213
views
Route-parameter contains parts of route
I have a route that looks like this:
/foo/{identifier}/bar/
I have configured the route like this:
httpConfiguration.Routes.MapHttpRoute("Foo1", "foo/{identifier}/bar/", new
{
...
0
votes
1
answer
53
views
Catch-all route is incorrectly prioritized over defined templates
I'm on dotnet 7.0.203; having a very simple problem, which I believe shouldn't be the case. I have a few routes and one catch-all route, with my expectation being catch-all should be executed with the ...
1
vote
1
answer
158
views
Html.ActionLink not aware of current area generates bad links
Context
I am migrating an ASP.NET MVC 5 app (running on .NET 4.7.2) to ASP.NET Core 2.2 on .NET 7.0. I am proceeding from a blank project and slowly moving-and-changing files. My current subject is ...
1
vote
2
answers
4k
views
MapControllers() does not find any endpoints
I just migrated from .net core 3.1 to .net 6.
My project is an WebApi.
All my controllers inherit from ControllerBase and they have an [ApiController] attribute with the appropriate [Route] attribute. ...
0
votes
1
answer
202
views
Why ASP.NET routing add id into the url?
I am making menu with categories, where first menu item is All categories. All items call method Index in controller Auction, however, first item does not send id as a parameter. I am curious, why I ...
2
votes
1
answer
411
views
How to Register Custom IRouter in .NET 7 MVC Application?
I have a custom IRouter implementation and I can't figure out how to register it in a .NET 7 MVC application.
What I am trying to accomplish is this: Incoming requests have the form of https://example....