Using ASP.NET Core Health Checks With ASP.NET Ful...
Health checks in ASP.NET Core are useful for reporting the health of your ASP.NET Core web application. But, this functionality can’t dir...
.NETHealth checks in ASP.NET Core are useful for reporting the health of your ASP.NET Core web application. But, this functionality can’t dir...
.NETAs I’ve walked through upgrading a number of solutions to target a new version of the .NET Framework, I’ve compiled a list of helpful ste...
.NETWhat is WSL? Windows Subsytsem for Linux (aka WSL) is an excellent tool for running Linux-based binaries natively in Windows. With the i...
WSL git ASP.NET MVCIn development it is common to not want to share everything in our code. Things like usernames, password, links to an api, and more shoul...
Vue.js JavaScript WebpackIn Vue computed properties are a life saver when it comes to being able to add logic to data that we need to use in the UI. We want to ke...
Vue.js JavaScriptUpdated Solution! Thanks for the post!If you don't want to create a web.config, you can also drive this through the <AspNetCoreHo...
asp.net asp.net coreI, Khalid Abuhakmeh, recently wrote about my [Razor Pages first impressions][khalid] and am mostly positive about the addition to the ASP...
asp.net asp.net core razorWe’re in the process of scaffolding out our Microsoft Azure environments using Terraform. While Terraform does an excellent job creating ...
Terraform OSSTL;DR Explicitly using SqlBulkCopy might never cause this problem since mapping is done manually, but NPoco’s usage does automatic map...
NPoco SqlBulkCopyAs you’re building out an API it’s important to keep response times in check. In many cases slowness is due to database calls, web reques...
Benchmarking OSSWe’ve accomplished so much this year thanks to @VueJS that we wanted to give back to the Vue community in some way. Ritter IM is sponsor...
VueJSEgg Fried Rice is a homey dish in China. In this post, I am going to show you my method to make this simple, quick, and delicious dish. E...
Food chinese cuisineAt Ritter Insurance Marketing we utilize Azure Web Apps for hosting many of our web applications. Azure Web Apps is a platform as a servi...
Azure Configuration OSSState management, Redux, Vuex… whatever you want to call it or whatever flavor you use, people have a lot of opinions about it. I’ve writ...
JavaScript VueIf you’re familiar with Vue at all, you’re probably familiar with the v-for. And if you’ve used any other front end frameworks, they each...
JavaScript VueDo you want to save 80% of your bandwidth to your search provider? Do you want to deliver content to your users faster? With this one tr...
Development Elasticsearch DebuggingWe operate in a typical QA -> Production workflow on both our front-end and back-end teams. So, what happnes when your front-end is in...
Development JavaScript Dev Ops Vue Vue.js JekyllIf you’re not familiar, or just haven’t used Sass maps, here’s your chance to dive in. Our latest static site was built on Jekyll using ...
sassIn JavaScript, we are always working with different data types to send to the API or display on the UI. Cloning and altering that clone i...
JavaScriptC# being an Object Oriented Programming (OOP) language, we have access to inheritance. Like any feature of a programming language, you sh...
csharp bugsI will start this post off by saying this may not be the best way to get the routes from your ASP.NET Core MVC web application. I am hoping there is a better way, but my current knowledge has led me to this answer. Given you have registered your routes, regardless of method, you should have a RouteCollection
buried somewhere deep in your running application instance.
The RouteCollection
is a member of the RouterMiddleware
that ASP.NET Core uses to determine whether the current request is a match. For good reason, the member is private and passed to you via RouteData
.
// from RouterMiddleware.Invoke
RouteContext context = new RouteContext(httpContext);
context.RouteData.Routers.Add(this._router);
Understanding what is happening inside of the RouterMiddleware
, we should be able to access the router from our MVC Controller. We want the first router that is of type RouteCollection
.
var routes = RouteData
.Routers
.OfType<RouteCollection>()
.FirstOrDefault();
The final step is to display the output in your view.
Hope this post helps you debug your routing issues in ASP.NET Core.