Practical .NET


Exploiting the Validation Tools in ASP.NET MVC

Your users will make mistakes ... but it would be a mistake to treat all their errors the same way. You can get more out of ASP.NET MVC's validation infrastructure just by paying attention to how you name your errors.

Returning JSON from SQL Server Queries

With JSON now the default format for moving data between clients and servers, SQL Server adds JSON support to make it easier to get your data out of the database and down to the client.

In-Memory ASP.NET Core Integration Tests with TestServer

Test, test and test again. You can automate those tests with a TestServer-based Web app that doesn't even touch the Web server.

Improving Feedback When Editing HTML

Get Visual Studio to be more helpful when you're working with HTML.

Send the Right Error Information with HttpException

When something goes wrong with your Web Service the decent thing to do is to return your errors in a variety of ways.

AJAX Without JavaScript

You like the idea of an AJAX application, but would rather not write the JavaScript yourself. You're in luck: ASP.NET MVC provides two tools that write the client-side code for you. And these tools even make sense if you’re comfortable with writing your own JavaScript.

Accept HTML and Script from Your Web Pages

Sensibly, ASP.NET MVC 5 prevents users from entering HTML or Script tags into your page's textboxes, protecting you from a wide variety of hacks. However, for those rare occasions when you do need to let the user enter tags, here's how to do it.

Calling Web Services with HttpWebRequest, WebClient and HttpClient

The .NET Framework gives you three different ways to call a Web Service. However, depending on your scenario, the latest and greatest object isn’t necessarily your best choice.

Add a Multi-Select ListBox or DropDownList to Your ASP.NET MVC View

Peter doesn't like them, but that doesn't mean you have to hate 'em, too -- here's how to add a listbox or dropdown list to your View that lets users select multiple items.

Serverless C# with Azure Functions: Implementing Webhooks

Azure Functions can be used to trigger event-driven Webhooks. Here’s how.

Reduce Overhead When Retrieving Objects with Entity Framework

If you're only retrieving an object so that you can read its data, you can reduce your costs by turning off Entity Framework tracking. Which is exactly what you want to do in ASP.NET MVC, as long as you're careful.

Leverage Global Filters and the HandleError Attribute in ASP.NET MVC Apps

Here's how to combine adding HandleError attributes to your ASP.NET MVC application both through Global Filters and adding them directly to your Action methods.

How I Approached Gaining Microsoft Certification

If you’re thinking about pursuing a Microsoft Certification, here’s how and why Peter went through the certification process for the second time, including his feedback on some of the resources available to you.

Exploiting Partial and RenderPartial in ASP.NET MVC

If you're wondering what the difference is between the HtmlHelper Partial and RenderPartial methods, then here's why Peter, at least, uses Partial.

Working with Exceptions Before the Error Handler Does

Normally, you don’t care about first-chance exceptions -- it's only when something becomes a second-chance exception that you start to pay attention. But when you do care about all the exceptions, here’s how to work with them both in Visual Studio and in your code.

Subscribe on YouTube