bitScry

  • Home
  • About
  • Blog
  • Contact

MVC

About this site

This is a blog to help me remember some of the coding challenges I’ve faced and hopefully help others out if they’re suffering the same problems.

Recent Posts
  • Serving Images from Blob Storage in an Azure Function
  • Redis Caching in .NET
  • Passing Environment Variables From Docker to .NET Web App
  • Retrieving Data from MySQL Stored Procedures in .NET
  • Excluding Child Properties from a List of Objects in Fluent Assertions
Tag Cloud

.NET .NET Core AAD API ASP.NET Core Authentication Authorization Azure Azure Active Directory Azure Function Azure Storage Blob Bootstrap C# Cloud Storage Console Application CSS DataTable Dependency Injection Dictionary Entity Framework Enum Extension Google HTML Image IP Address JavaScript jQuery JSON List MVC MVC 6 Newtonsoft RestSharp Serilog SQL Stored Procedure Stream Table Table Storage Test Web App Web Application WordPress

Programming

Escaping the @ Symbol in an MVC View

I’ve been working with OData recently and one thing that briefly stumped me was that the property names begin with @ and in an MVC view the @ symbol is used to indicate C# code so when I tried to reference a property in JavaScript the page then thought I Read more…

By Shinigami, 3 years2 April 2020 ago
Programming

Generating URLs in an MVC Page

If you want to generate URLs for use in an MVC webpage for actions in your controller then the UrlHelper Action method is pretty handy. This can be embedded into your cshtml page and will generate a URL at runtime for the specified action which will be relative to where Read more…

By Shinigami, 4 years19 March 2019 ago
Programming

Passing URL Parameters Through A Razor Page

While trying to take the URL parameters from a page view and append them to an API call from a Razor web page in an MVC web application I kept on getting the URI encoded version of the ampersand from Context.Request.QueryString rather than the raw one that’s needed to separate Read more…

By Shinigami, 5 years30 October 2018 ago
Programming

Complex objects in Session and TempData Variables

Session and TempData variables can be used in MVC controllers to pass variables between actions or from actions to views, however if you want to pass complex objects through using these variables the base classes need to be extended to serialize/deserialize the provided objects to/from JSON. Once the above classes Read more…

By Shinigami, 5 years31 August 2018 ago
Programming

Bootstrap 4 Contact Form with Google reCaptcha

I’ve just started building a site using Bootstrap 4 which is different enough to Bootstrap 3 that I’m having to relearn a few things. One of those is form validation as previously I used bootstrap-validator though this doesn’t yet work with version 4. Version 4 does have it’s own inbuilt Read more…

By Shinigami, 5 years5 June 2018 ago
Programming

Uploading Files in ASP.NET Core from an MVC View

I’ve been working on creating a page for for the uploading of files to either a SQL database or Azure Blob storage which turned out to be much more complicated than initially expected. I managed to eventually piece together how to do this and the resulting demo project can be Read more…

By Shinigami, 5 years12 March 2018 ago
Programming

Returning HTTP Status Codes from ASP.NET Core Methods

Sometimes in an MVC controller you just want to return a HTTP status code from a method rather than a view or data object. This is pretty simple but is done slightly differently in .NET Core than it was done previously. Some of the more common status codes such as Read more…

By Shinigami, 5 years17 January 2018 ago
Programming

Posting Data to an MVC Controller With jQuery

The easiest way to post data from a view to a controller action is by adding a form and submit button and letting most of the hard stuff happen automatically. Unfortunately this doesn’t really work in cases where data needs to be submitted by a javascript function, in these situations Read more…

By Shinigami, 6 years3 October 2017 ago
Programming

Select List Enum Tag Helper

If you want to have a select list in a web page which is based on all the values in an enum then you can use the built in function “Html.GetEnumSelectList” with a tag helper.

By Shinigami, 6 years22 September 2017 ago
  • Facebook
  • Twitter
  • Instagram
  • Email
Hestia | Developed by ThemeIsle