Ah, good old ASP.NET.
This post describes the easiest way to show description texts for properties in ASP.NET MVC 5. Sounds simple, right? We can use something like @Html.DescriptionFor(x => x.Property), right? Alas, it’s not that straightforward. A bit surprisingly, there’s no ready-made helper function for this. I’m saying “surprisingly”, because I feel like MVC 5 really already has all the bells and whistles – AND the kitchen sink. But no, it does not have a helper for getting a description of a property :) You can, however, define…Continue reading How to get the Description for a property in ASP.NET MVC 5?
Ha – another one, that ended up being a simple fix, but since nobody actually explains it well, took me an hour to figure out. This post ended up being another example of my “I’m going to document every single fix that took me more than 10 minutes to figure out, since that’ll help me (and others) the next time the same issue arises.” blogging strategy. Snappy name, right? 😅 Ah, well, naming things is really, really difficult. Anyway, I ended up banging my head…Continue reading How to fix Microsoft.AspNetCore.Mvc.TagHelpers not being rendered!
Have you ever been struggling, to make your ASP.NET MVC views format your properties of type datetime correctly? I have. And I’ve been shot in the leg by weird hacks made by both me (just 6 months earlier) or someone else. .NET Date/DateTime formatting is an endless bag of fun in general. So I thought I’d finally document the different ways one can set up the formatting of datetime fields in ASP.NET MVC projects specifically. Or at least all the ways I’ve found so far!…Continue reading How to format dates in ASP.NET?
Google is shutting down their Facebook killer, Google+. While I’m sure there’s at least 10 end users that are sad to see the ill-fated not-that-social-medium go, the implications for Software Developers actually could be far more far-reaching. A lot of implementations of Google’s OAuth seem to rely on Google Plus’s APIs to get gather information about the user. When Google Plus goes down, so will the APIs. Their apparently unsafe implementation seems to be a major reason Google’s hastening the shutdown anyway. This means that…Continue reading Google Plus is shutting down – fix your .NET OAuth flow!
Is your Azure Web Application suffering from absolutely horrible load times every time someone accesses it for the first time every 15 minutes or so? Mine was. It was pitiful. I was developing a web-based service using EF6 and ASP.NET MVC 5, where all the assets were hosted in the Azure. Even though the app was reasonably lightweight and usually responded very fast, the first time someone accessed it in a while it took 20-60 seconds to load AND sometimes even timed out (especially with…Continue reading Solving Azure Web Application’s first load perfomance issues
This post describes the easiest way to debug the issues that may stop your Seed-method in Configuration.cs from going through. This problem concerns typically your ASP.NET MVC projects, either on .NET Framework or .NET Core – the same basic idea should work for both situations. The solution here shows you, how you can get a little bit more information out of the process, without attaching the debugger (there’s another blog post for that: How to launch the visual studio debugger from code/) Description Entity Framework’s…Continue reading Easiest way to debug Seed-method in Code-first migrations in Entity Framework
This post describes the fix to error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’“, which Visual Studio throws at your face when you try to run an application on any Windows-based system (or which you’ve dug out of event logs). Also, your application is probably built on .NET Framework and Entity Framework. Let’s get into it! Error When debugging/running your code, somewhere in your code where you’re supposed to access the database using Entity Framework, you get an error like…Continue reading Fixing error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’”
This page describes mutiple ways on how to fix the exception ‘Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.‘ which comes up during debugging or publishing your program, app or service using DbGeography. Symptoms While running a console program or perhaps installing an ASP.NET MVC website on a machine, where SQL Server (apart from the one that comes with the Visual Studio) has not been installed, you may encounter the following error:…Continue reading Solving the “Spatial types and functions are not available …” -problem
Are you getting duplicate object values (or whatever those Objects output in .ToString())? Eh, so was I, after I edited the display template for String. Found a fix, though. Description Okay – I just ran into one of my more stupid mistakes since.. Well, since forever. I had made some quick and simple edits in String.cshtml display template (among quite a few other edits before building again and seeing what happened), as I added support for Enum values there. After that I started getting duplicate…Continue reading Duplicate object values in ASP.NET MVC Display Templates? Easy fix!
This post describes an issue with EF’s code-first migrations, when mapping between DB’s DateTime (datetime2) and C#’s DateTime simply fails, and results in the Update-Database cmdlet failing, too. It’s more or less a prime example of a situation, where the error itself tells very little about the actual issue, and since debugging code-first migrations is kind of difficult (see the best tips for that here!), it’s cumbersome to investigate. Symptoms So what’s the error that we’re running into, exactly? Below, you can find the most…Continue reading Fixing “An error occurred while updating the entries” while running code-first migrations in MVC 5 app
This post describes how to resolve a kind of cryptic and oddly misdescriptive error message about Parser Error on your ASP.NET application or (an On-Premises) SharePoint site. I ran into this after deploying wsp-packages to a SharePoint farm, but you can apparently get this on ASP.NET MVC sites, too. The error doesn’t actually tell you what’s wrong, so figuring it out took a while. Hopefully it’ll help you, though! Symptoms: Parser Error from a random-looking location Once you navigate to your web- or SharePoint site, you only…Continue reading “Server Error in ‘/’ Application” or “Parser Error” – it’s actually a malformed web.config killing your ASP.NET-application or SharePoint