Category: ASP.NET

  • Integrating with Twilio using C#

    I like when integrations like Twilio are simple and straightforward. I recently had the privilege of implementing it for my company. For my implementation I have a couple of special requirements that I think makes my solution better than just referencing a NuGet package and calling MessageResource.Create.

    My requirements require creating user controlled text messaging templates and customer controlled enabling/disabling of one or more text messages. Let’s get started.

    Integrating with Twilio using C#

    (more…)

  • Create MVC DropDownList from an Enum

    Like many requested features, MVC 5 now has a built-in function to provide an Enum object and automatically build a dropdown list using the standard HtmlHelper. If you’re unfortunate and on an older version of MVC, here is an HtmlExtension that performs the same thing.

    (more…)

  • Using ActionFilterAttribute to validate all form input

    I’m a big fan of using ActionFilterAttribute to apply a global filter on every single ASP.NET MVC request. I am going to create a custom filter that will implement ActionFilterAttribute to validate that the ModelState is valid for all POST or PUT requests.

    (more…)

  • The JSON request was too large to be deserialized

    The JSON request was too large to be deserialized is a very common error because of MVC’s default size for a JSON response from the Web Api. Luckily there is a very simple solution that requires a minor change in your Web.config

    (more…)

  • Solution to SameSite None iFrames with C#

    There has been a lot of kerfuffle over Chrome’s upcoming change to how cookies are based when one website is iFraming another website in an effort to further improve the security of the Internet.

    At the end of the day, the solution is to set your cookies – specifically the .ASPXAUTH cookie – so that when users navigate the website of the iFrame source the cookies will be passed from page-to-page. This is very important to those who are using FormAuthentication.

    The solution requires two changes. Let’s look at them now.

    (more…)