Tags down


ASP.NET Core 3.0 Endpoint Routing doesn't work for default route

By : Enster
Date : September 29 2020, 04:00 AM
like below fixes the issue From Attribute routing vs conventional routing:
code :
public class WeatherForecastController : ControllerBase
   public void ConfigureServices(IServiceCollection services)

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        if (env.IsDevelopment())




        app.UseEndpoints(endpoints =>
                name: "Default",
                pattern: "{controller=default}/{action=Index}/{id?}");
public class DefaultController : ControllerBase
    public  ActionResult<string> Index()
        return "value";

    public ActionResult<int> GetById(int id)
        return id;

Share : facebook icon twitter icon

Default Route does not work after upgrading to MVC5 with Attribute Routing

By : user3030746
Date : March 29 2020, 07:55 AM
hope this fix your issue Ah.. got it!
Based on Kiran's answer to : Specify default controller/action route in WebAPI using AttributeRouting
code :
// Controller
public class HomeController : MvcControllerBase
    // Action
    [HttpGet, Route, Route("home"), Route("home/index")]
    public ActionResult Index()

With attribute routing enabled, and no default routing, why is my API still returning on the old default route?

By : Maff
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I found this question: MVC Attribute Routing Not Working
It suggested that I need to update my Global.asax.cs file to the following:
code :
public class Global : HttpApplication
    void Application_Start(object sender, EventArgs e)

ASP.NET Core 3 MVC endpoint routing and localization by route

By : user3338650
Date : March 29 2020, 07:55 AM
wish helps you The blog show us how to translate the url when you send request.But in your case,you just want to render url,it should add route template to match it.
Here is a smiple workaround like below:
code :
Dictionary<string, string> routePol = new Dictionary<string, string>();
routePol.Add("language", "pl");
routePol.Add("controller", "zamowienia");
routePol.Add("action", "lista");    
@*controler name and action name should be the key name in TranslationDatabase 
not the value name.*@
<a asp-all-route-data="routePol">Poland</a>
app.UseEndpoints(endpoints =>
                name: "default",
                pattern: "{language=pl}/{controller=orders}/{action=list}");


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

By : user3487493
Date : March 29 2020, 07:55 AM
this one helps. Simple redirecting at the top of my Index action method did the work, after checking if the user is logged in or not redirect to login page.
code :
        public async Task<IActionResult> Index()
            if (true)// implement cookie policy
                return RedirectToAction("Login");

Cannot use 'Microsoft.AspNet.OData.Routing.ODataRoute' with Endpoint Routing.' Exception with ASP Net Core 2.2

By : Siva Nagendra
Date : March 29 2020, 07:55 AM
like below fixes the issue I was having same issue after upgrading to .net core 2.2 and found that .net core 2.2 has enabled endpoint routing by default and they have backward capability to disable it like this. It worked for me .
code :
services.AddMvc(options =>
                  options.EnableEndpointRouting = false;
Related Posts Related Posts :
  • AVX2 SIMD XOR not yielding performance improvements in .NET
  • Algorithm to find the closest time
  • Xamarin Form - How To store an image in PDF or JPEG Format in UWP
  • ModelState error: The value 'null' is not valid for nullable field
  • Pre Increment of an operator
  • MSTest Asserts fail with null reference
  • Getting random numbers after a simple math problem. Might be a local variable thing
  • Convert HTML to PDF using HTML Renderer using C# and XML to Pdf
  • Conversion failed when converting varchar value to datatype bit
  • How to edit an XML file in Streamingassets from my hololens
  • Naming a DispatcherTimer based on a string from another method?
  • How to call the default browser in the Hololens app
  • How do I close an IF statement if there is no more code to be executed with 'else'?
  • Unity3D: Is there a easy way to give a min/max to a value in the inspector?
  • The type or namespace name 'ICloudRecoEventHandler' could not be found
  • When compiling C# expression trees into methods, is it possible to access "this"?
  • Sort an array of strings in ascending order in C#
  • How detect is a method in a C# class is implementing a method from an interface?
  • How to parse a timespan in order to add it to a datetime?
  • Changing code from if-statement to switch-statement in C#
  • Linq GroupBy Clause not including items with zero count
  • How to determine the highest value in a list of properties
  • C# Custom Json.NET List serialization
  • Session Variable is null after using RedirectToAction
  • How to manipulate c# code programatically In .Net Core?
  • Modifying Windows System sounds
  • Is there a way to convert this powershell script to C#
  • Lists will show null even though assigned in constructor
  • Any way to have a `using` block that doesn't define a scope block?
  • How do I get a result from this mocked service?
  • async await losing response in c#
  • How can I pause an execution without using Thread.Sleep()
  • How to Stop In Azure Ad Authentication Sign Out ask for Which account do you want to sign out of?
  • Use operators with and without space in c#
  • Remove duplicates from comma separated list
  • Use a String variable as argument from if sentence
  • unity how to avoid scaling heritage when parenting?
  • Is there a way to do nested model binding with the [FromBody] attribute?
  • How to insert dynamic query into table using c#
  • Why Unit Testing Assert.AreEqual() method does NOT pick up my own Equals() method in the customized class
  • Unity Error: Feature 'out variable declaration'
  • What happens if my C# switch expression is non-exhaustive?
  • How Can I Select an ItemTemplate Based on a Value?
  • EF Class table name and column have same name
  • Substring issues - input string was not in a correct format
  • C# Asynchronously read data from a redirected StandardOutput
  • The code after await operation is not executing
  • Image FILL logic such as "Stretch.Uniform" of WPF
  • Why am I allowed to declare a variable with the same name?
  • Simplest way to display colored 3D boxes in winforms
  • Conventions on having both an API and MVC project in .NET Core solution
  • File upload .NET Core 'IFormFile' does not contain a definition for 'CopyToAsync' and no extension method
  • Deserialize only valid objects by ignoring errors
  • How to write into text file what is ordered by years
  • Remove this 'return' statement or make it conditional
  • Cannot implicitly convert type "System.DateTime" to "LearnScan.LearnUser.NullableDateTime"
  • Why does DateTime.UtcNow.Subtract give me a massive number sometimes?
  • How to restart CancellationTokenSource after make it cancel in c#?
  • Same data is fetched from the database every time
  • JSON Deserialize is not working with List object
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk