Posts tagged "ASP.NET"

Published:

C# - Pure Pagination Logic in C# / ASP.NET

Pure pagination logic written in C# / ASP.NET and available on NuGet. Compatible with ASP.NET Core and ASP.NET Standard projects.
Published:

ASP.NET Core Razor Pages - Pagination Example

An example of how to add pagination to your ASP.NET Core 2.1 Razor Pages application.
Published:

C# / ASP.NET - Domain Validation Logic in Domain Driven Design (DDD)

An example showing how and where to implement Domain Model Validation in C# and ASP.NET projects using Domain Driven Design (DDD)
Published:

ASP.NET MVC - Pagination Example with Logic like Google

An example of how to setup Google style pagination logic in C# and ASP.NET MVC.
Published:

Fluent NHibernate - Unproxy Entity Objects with AutoMapper

How to unproxy NHibernate objects to get real entity objects instead of NHibernate proxied classes.
Published:

C# - Incremental Delay to Prevent Brute Force or Dictionary Attack

An example of how to implement an incremental delay in C# to prevent brute force or dictionary attacks on an MVC login form.
Published:

Unit of Work + Repository Pattern in MVC5 and Web API 2 with Fluent NHibernate and Ninject

After a lot of digging around to figure the best way to implement the Unit of Work + Repository pattern in an ASP.NET MVC 5 or Web API 2 application, I came up with this solution.
Published:

ASP.NET - Fix for HTTPS/SSL Insecure/Mixed Content Warning

After setting up automatic redirects from HTTP to HTTPS you may start seeing browser warnings about "insecure content" or "mixed content" and some content may be blocked and not displayed, this is because some of the external content references in your html are still using an insecure "http://" url.
Published:

Dynamic LINQ - Using strings to sort by properties and child object properties

I stumbled across the Dynamic LINQ Library today and can't figure out why more people aren't talking about it. It's an awesome little library that allows you to dynamically generate LINQ expressions from strings, which is perfect for things like sorting collections by object property names passed as querystring parameters to web api controllers, it even allows you to sort by child object property names!
Published:

Web API 2 + ELMAH - Log ALL Unhandled Exceptions

I got an email from a client today about an error happening in an application that I'd built with ASP.NET Web API 2.1. At first I thought they must be mistaken or doing something wrong on their end because their weren't any errors being reported by ELMAH which I'd configured in my WebApiConfig.cs file using the ElmahHandleErrorApiAttribute filter.
Published:

Moq - Get Setup() to return a dynamic collection from a fake repository

Read on if you're confused about why your mock repository keeps returning the initial collection even though you've added something to it!
Published:

Post a simple string value from AngularJS to .NET Web API

How to post a simple string parameter in the body of an HTTP request from AngularJS to ASP.NET Web API
Published:

ASP.NET Web API - elmah.axd 404 error - No HTTP resource was found that matches the request URI 'http://.../elmah.axd'

Fix for ELMAH 404 error "No HTTP resource was found that matches the request URI 'http://.../elmah.axd'"
Published:

ASP.NET MVC - Required Checkbox with Data Annotations

How to make a required checkbox in ASP.NET MVC using the built in 'Range' data annotation attribute.
Published:

C# - Get time zone and UTC offset from latitude and longitude (GPS coordinates)

I recently set up an Instagram feed for a travel blog and found that the Instagram API only supplies the UTC created date/time of each image, and doesn't supply the user's UTC Offset (as the Twitter API does), so the only thing you have to work with are the latitude and longitude (lat/long) coordinates to find out the timezone and UTC Offset of where the image was posted.
Published:

MVC CheckboxList for property of type IList<Enum>

This is an extension method for creating a checkbox list for a list of enum values (IList<Enum>). It's a modified version of the CheckboxListForEnum extension method I found on the Xango project. Their version creates a checkbox list for a property that contains a single enum value.
Published:

IIS URL Rewrite - Redirect multiple domains to one and http to https with a single rule

Redirecting multiple domains to one and http to https is a pretty common requirement, and the are plenty of examples online showing how to do this using the IIS URL Rewrite Module. Most of the examples I've seen work fine, but use separate rules for redirecting each domain and for redirecting http to https, resulting in something like this:
Published:

MVC3 redirect to mobile site and stop executing

Response.Redirect(url, true) does NOT stop executing. Automatically redirect iPhone to mobile site.
Published:

ASP.NET MVC3 + Altairis Web Security Toolkit

In this post I'll show you how to install and configure the Altairis Web Security Toolkit in an MVC3 application. The Altairis Web Security Toolkit is a simple, easy to use ASP.NET Membership Provider with a clean table structure. It's much nicer to work with than the default ASP.NET Membership Provider.
Published:

MVC3 Partial View Validation

I came across a problem recently with server side validation of partial views in MVC3.
Published:

Dependency Injection in 1 line with MVC3 and Ninject

With the help of the NuGet and the Ninject extensions Ninject.MVC3 and Ninject.Extensions.Conventions, you can get dependency injection up and running with just 1 line of code!
Published:

Populate ASP.NET dropdown list with month names using LINQ

Using LINQ and the Enumerable.Range method it's possible to populate a dropdown list of month names in a single line.
Supported by