Category: ASP.NET

  • Azure .NET Core Web App and Where to Locate Static Files

    In Azure your web app is written to the “d:\home\site\wwwroot” folder, and if you deploy with Visual Studio and choose “Remove additional files at destination” anything not in your project will be removed from “d:\home\site\wwwroot”. The default Continuous Integration profile on Azure DevOps does not remove files in “d:\home\site\wwwroot” but overwrites, this can get you […]

  • .NET Core Razor Page Email Form using SendGrid and reCaptcha

    I wanted to put a “Contact Us” email form on my .NET Core App driven web site deployed on Azure. I wanted to protect it somewhat by using reCaptcha to reduce the spam emails, and I also wanted to use SendGrid rather than my own smtp server. Preparing for SendGrid SendGrid has a free plan […]

  • Setting Up Serilog in a .NET Core 2.2 Web App Deployed to Azure

    The standard .NET Core logging is all well and good, but it doesn’t give you logging to a file out of the box. My requirements were to display the application log messages in the Visual Studio Debug window and also log them to a physical file whilst in development on my local PC, but then […]

  • Azure DevOps CI Pipeline Fails with .NET Core 2.2

    I tried putting a test CI build from Azure DevOps (formally VSTS) to a test web site using NET Core 2.2 today, but it failed with “Packages failed to restore”. Further investigation revealed that it failed in the “_CheckForUnsupportedNETCoreVersion” step. It appears that if you are using .NET Core 2.2 as a target it will […]

  • Customising Bootstrap in ASP .NET Core 2.2 Web Application Projects

    The default Web Application template for .NET Core 2.2 in Visual Studio 2017 contains a default implementation of Bootstrap in the “wwwroot/lib” folder, which is fine if you are not concerned about your application/site being styled like every other Bootstrap site or including sizeable css and js files regardless of whether you are using all […]

  • OpenCover and ReportGenerator Unit Test Coverage in Visual Studio 2013 and 2015

    The usual choices for getting code coverage metrics in Visual Studio is to buy the Enterprise version of Visual Studio or buy the dotCover third party tool, both of which are costly, especially if you are developing small applications yourself and want to check the coverage of your unit tests. There is a free NuGet […]

  • Setting SSRS Report Parameters from ASP.NET C# Code

    It is sometimes necessary to customise SSRS (SQL Server Reporting Services) reports at runtime and one way of achieving this is through the use of report parameters. One reason for doing this might be to customise the report title, column headers, currency, number formats and date formats based on the user’s language settings.

  • Back Button issue after Logout in ASP.NET

    This is the code most of us would normally use when logging out a user: FormsAuthentication.SignOut(); FormsAuthentication.RedirectToLoginPage(); A frequent problem is that after a user logs out of their application using this code or similar, if they then use the back button they are presented with pages from the application without having to login. The […]

  • Preventing a User From Having Multiple Concurrent Sessions

    This article is largely based on information learned within the book “Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB” by Bilal Haidar. A common question asked regarding ASP.NET is how can you prevent a user logging on more than once at the same time. Unfortunately, the nature of ASP.NET means that […]