<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>C# on Bryan Avery</title><link>https://bryanavery.co.uk/categories/c%23/</link><description>Recent content in C# on Bryan Avery</description><generator>Hugo -- gohugo.io</generator><language>en-GB</language><copyright>© 2026 Bryan Avery.</copyright><lastBuildDate>Mon, 12 Jan 2026 12:09:36 +0000</lastBuildDate><atom:link href="https://bryanavery.co.uk/categories/c%23/index.xml" rel="self" type="application/rss+xml"/><item><title>Who Really Controls Your Data? The Truth About Sovereign Cloud</title><link>https://bryanavery.co.uk/who-really-controls-your-data-the-truth-about-sovereign-cloud/</link><pubDate>Mon, 12 Jan 2026 12:09:36 +0000</pubDate><guid>https://bryanavery.co.uk/who-really-controls-your-data-the-truth-about-sovereign-cloud/</guid><description>&lt;p&gt;Cloud computing is now so normal that most organisations barely think twice about where their data lives. It sits in “the cloud”, it works, it’s secure, and everyone moves on. Yet behind the scenes, a quieter but increasingly important conversation is taking place in boardrooms, regulator meetings and procurement discussions. That conversation is about sovereignty.&lt;/p&gt;</description></item><item><title>Web Application Security: What Every Business Needs to Get Right</title><link>https://bryanavery.co.uk/web-application-security-what-every-business-needs-to-get-right/</link><pubDate>Mon, 15 Dec 2025 09:40:15 +0000</pubDate><guid>https://bryanavery.co.uk/web-application-security-what-every-business-needs-to-get-right/</guid><description>&lt;p&gt;If your business runs a website, customer portal, booking system, online shop, or internal web-based tool, then web application security is not optional. Web applications are one of the most common entry points for cyber attacks because they are public-facing, interactive, and often connected to sensitive data.&lt;/p&gt;</description></item><item><title>AI-Augmented DevSecOps: Securing the Software Supply Chain at Scale</title><link>https://bryanavery.co.uk/ai-augmented-devsecops-securing-the-software-supply-chain-at-scale/</link><pubDate>Mon, 08 Dec 2025 10:22:39 +0000</pubDate><guid>https://bryanavery.co.uk/ai-augmented-devsecops-securing-the-software-supply-chain-at-scale/</guid><description>&lt;h3&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/h3&gt;&#10;&lt;p&gt;Software development has evolved rapidly, and with it, the need for robust security practices has never been greater. Across industries, organizations are embracing &lt;strong&gt;DevSecOps&lt;/strong&gt;—a methodology that integrates security into every stage of the development lifecycle. This shift is essential because open-source adoption has skyrocketed, growing from just 36% of codebases in 2015 to 75% in 2020. While this trend accelerates innovation, it also introduces significant risks. High-profile breaches, such as the SolarWinds attack, have demonstrated how vulnerable the software supply chain can be when security is not prioritized.&lt;/p&gt;</description></item><item><title>Citadel Governance Hub: The Enterprise Blueprint for Scaling AI Safely, Responsibly and Efficiently</title><link>https://bryanavery.co.uk/citadel-governance-hub-the-enterprise-blueprint-for-scaling-ai-safely-responsibly-and-efficiently/</link><pubDate>Fri, 05 Dec 2025 08:25:15 +0000</pubDate><guid>https://bryanavery.co.uk/citadel-governance-hub-the-enterprise-blueprint-for-scaling-ai-safely-responsibly-and-efficiently/</guid><description>&lt;p&gt;Businesses of every size are now moving far beyond early AI experimentation. What began with simple copilots and isolated proof-of-concepts has quickly evolved into a landscape where organisations expect to operate dozens—and soon thousands—of AI agents across their departments. These agents will collaborate with one another, call internal and external systems, interpret complex contexts and support increasingly critical business processes. As this shift accelerates, one question becomes unavoidable: &lt;em&gt;how do we allow AI to scale without losing control, breaching compliance, duplicating effort or suffocating innovation?&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Unlocking the Power of Microsoft’s Researcher Agent: A Deep Dive into Intelligent Workflows</title><link>https://bryanavery.co.uk/unlocking-the-power-of-microsofts-researcher-agent-a-deep-dive-into-intelligent-workflows/</link><pubDate>Fri, 27 Jun 2025 08:10:41 +0000</pubDate><guid>https://bryanavery.co.uk/unlocking-the-power-of-microsofts-researcher-agent-a-deep-dive-into-intelligent-workflows/</guid><description>&lt;p&gt;Artificial Intelligence has rapidly evolved beyond simple productivity tools and into highly capable research assistants. One of the most promising innovations in Microsoft’s Copilot ecosystem is the &lt;em&gt;Researcher Agent&lt;/em&gt;—a specialised AI agent designed to perform complex research tasks across a range of data sources and systems.&lt;/p&gt;</description></item><item><title>Rethinking Technical Architecture: AI-Driven Developer Experience as the Catalyst for Scalable Innovation</title><link>https://bryanavery.co.uk/rethinking-technical-architecture-ai-driven-developer-experience-as-the-catalyst-for-scalable-innovation/</link><pubDate>Thu, 19 Jun 2025 08:32:29 +0000</pubDate><guid>https://bryanavery.co.uk/rethinking-technical-architecture-ai-driven-developer-experience-as-the-catalyst-for-scalable-innovation/</guid><description>&lt;p&gt;As organisations embrace AI to modernise operations, the architectural lens must now extend beyond infrastructure and applications to include how software teams interact with their tools. Enhancing the &lt;strong&gt;developer experience (DevEx)&lt;/strong&gt; is becoming a vital strategic pillar, not only for productivity, but also for architectural consistency, security, and scalability.&lt;/p&gt;</description></item><item><title>Meet Dot: Your Expert AI Assistant for C# and .NET Development</title><link>https://bryanavery.co.uk/meet-dot-your-expert-ai-assistant-for-c-and-net-development/</link><pubDate>Tue, 20 May 2025 06:25:57 +0000</pubDate><guid>https://bryanavery.co.uk/meet-dot-your-expert-ai-assistant-for-c-and-net-development/</guid><description>&lt;p&gt;The modern software landscape is evolving fast, and .NET developers need tools that keep up. Whether you’re spinning up a new microservice, building clean RESTful APIs, or wrangling Entity Framework migrations, wouldn’t it be ideal to have an assistant who &lt;em&gt;knows&lt;/em&gt; .NET inside out?&lt;/p&gt;</description></item><item><title>Building Cursor-Based Pagination with Redis and .NET for External API Integrations</title><link>https://bryanavery.co.uk/building-cursor-based-pagination-with-redis-and-net-for-external-api-integrations/</link><pubDate>Sun, 18 May 2025 10:55:00 +0000</pubDate><guid>https://bryanavery.co.uk/building-cursor-based-pagination-with-redis-and-net-for-external-api-integrations/</guid><description>&lt;p&gt;When building modern APIs that integrate with external systems, a common challenge is enabling &lt;strong&gt;efficient, scalable pagination&lt;/strong&gt; — especially when the external system doesn’t support pagination natively. This post walks through a practical, production-ready solution using &lt;strong&gt;cursor-based pagination and Redis caching&lt;/strong&gt; in a .NET Web API environment.&lt;/p&gt;</description></item><item><title>Advanced Fault Tolerance in .NET 8 Using Microsoft’s Resilience Framework</title><link>https://bryanavery.co.uk/advanced-fault-tolerance-in-net-8-using-microsofts-resilience-framework/</link><pubDate>Tue, 06 May 2025 10:39:42 +0000</pubDate><guid>https://bryanavery.co.uk/advanced-fault-tolerance-in-net-8-using-microsofts-resilience-framework/</guid><description>&lt;p&gt;In my original &lt;a href="https://github.com/BryanAvery/PollyHttpClientFactory"&gt;Polly article&lt;/a&gt;, I introduced Polly as a robust resilience framework for handling transient faults and service failures. At the time, Polly was entirely community-driven and required manual configuration within each application. Fast forward five years, and Microsoft has officially embraced the concepts introduced by Polly, incorporating them directly into the .NET framework with a suite of first-party resilience libraries.&lt;/p&gt;</description></item><item><title>Taming the Machines: Why AI Governance Matters More Than Ever</title><link>https://bryanavery.co.uk/taming-the-machines-why-ai-governance-matters-more-than-ever/</link><pubDate>Fri, 28 Mar 2025 07:15:15 +0000</pubDate><guid>https://bryanavery.co.uk/taming-the-machines-why-ai-governance-matters-more-than-ever/</guid><description>&lt;p&gt;Artificial Intelligence (AI) is no longer the stuff of science fiction. From automating emails to analysing business trends, AI agents are already helping organisations save time, reduce costs, and make better decisions. But with great power comes great responsibility—and that’s where &lt;strong&gt;governance&lt;/strong&gt; comes into play.&lt;/p&gt;</description></item><item><title>Integrating OpenAI into E-commerce: A Microservices Approach</title><link>https://bryanavery.co.uk/integrating-openai-into-e-commerce-a-microservices-approach/</link><pubDate>Wed, 15 Nov 2023 16:42:30 +0000</pubDate><guid>https://bryanavery.co.uk/integrating-openai-into-e-commerce-a-microservices-approach/</guid><description>&lt;p&gt;In the ever-evolving landscape of e-commerce, integrating intelligent systems has become not just an advantage but a necessity. This is where OpenAI comes into play within a microservices architecture. Let’s delve into a system blueprint and see how OpenAI enriches the e-commerce ecosystem.&lt;/p&gt;</description></item><item><title>Exploring the Safe Haven of Windows 11 Sandbox</title><link>https://bryanavery.co.uk/exploring-the-safe-haven-of-windows-11-sandbox/</link><pubDate>Sun, 29 Oct 2023 14:12:17 +0000</pubDate><guid>https://bryanavery.co.uk/exploring-the-safe-haven-of-windows-11-sandbox/</guid><description>&lt;p&gt;Are you ever hesitant to test new software or visit unfamiliar websites due to concerns about potential harm to your computer? Microsoft has your back with Windows 11 Sandbox, a feature that allows you to create a secure and isolated virtual environment for experimenting with software and browsing the web without putting your primary system at risk. In this blog post, we’ll dive into what Windows 11 Sandbox is and how you can access and use it on your Windows 11 Pro, Enterprise, or Education edition.&lt;/p&gt;</description></item><item><title>Tomb AI: A New Way to Create Stories with Artificial Intelligence</title><link>https://bryanavery.co.uk/tomb-ai-a-new-way-to-create-stories-with-artificial-intelligence/</link><pubDate>Fri, 09 Jun 2023 08:17:39 +0000</pubDate><guid>https://bryanavery.co.uk/tomb-ai-a-new-way-to-create-stories-with-artificial-intelligence/</guid><description>&lt;p&gt;Have you ever wanted to write a story but felt stuck or uninspired? Or maybe you have a great idea but don’t have the time or skills to turn it into a captivating narrative. If so, you might be interested in Tomb AI, a new online platform that uses artificial intelligence (AI) to help you create stories from scratch.&lt;/p&gt;</description></item><item><title>Software Composition Analysis Tools</title><link>https://bryanavery.co.uk/software-composition-analysis-tools/</link><pubDate>Thu, 13 Apr 2023 13:20:34 +0000</pubDate><guid>https://bryanavery.co.uk/software-composition-analysis-tools/</guid><description>&lt;p&gt;This post shows how each provider measures up and helps you select the correct Software Composition Analysis for your needs.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Fact&lt;/strong&gt;: Software Composition Analysis (SCA) protects the software supply chain. In a report by Forrester&lt;a href="https://bryanavery.co.uk/index.html%3Fp=1651.html#_ftn1" rel="noreferrer noopener" target="_blank"&gt;[1]&lt;/a&gt; and Gartner&lt;a href="https://bryanavery.co.uk/index.html%3Fp=1651.html#_ftn2" rel="noreferrer noopener" target="_blank"&gt;[2]&lt;/a&gt;, they explore how industry providers measure up, which will assist you in selecting the right one for your needs. It’s a valuable assessment of top suppliers in today’s market. Details below are an extract of this report with additional information which applies to our environment.&lt;/p&gt;</description></item><item><title>Security Policies and Guidelines</title><link>https://bryanavery.co.uk/security-policies-and-guidelines/</link><pubDate>Wed, 05 Apr 2023 16:40:18 +0000</pubDate><guid>https://bryanavery.co.uk/security-policies-and-guidelines/</guid><description>&lt;p&gt;Here is a list of Security Policies and Guidelines from Microsoft&lt;/p&gt;&#10;&lt;span id="more-1647"&gt;&lt;/span&gt;&#10;&lt;p&gt;For V01: https://learn.microsoft.com/en-us/azure/storage/blobs/security-recommendations#:~:text=Require%20secure%20transfer%20(HTTPS)%20to%20the%20storage%20account&lt;br/&gt;For V02: https://learn.microsoft.com/en-us/azure/app-service/security-recommendations#:~:text=Use%20static%20IP%20restrictions&lt;br/&gt;For V03: No Microsoft recommendation applies here&lt;br/&gt;For V04: https://learn.microsoft.com/en-us/security/benchmark/azure/baselines/service-bus-security-baseline#dp-3-encrypt-sensitive-data-in-transit&lt;br/&gt;For V05: https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-overview#best-practices&lt;br/&gt;For V06: https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-overview#best-practices&lt;br/&gt;For V07: https://learn.microsoft.com/en-us/azure/storage/blobs/security-recommendations#networking:~:text=Enable%20firewall%20rules and https://learn.microsoft.com/en-us/azure/key-vault/general/best-practices#:~:text=Turn%20on%20firewall%20and%20virtual%20network%20service%20endpoints.&lt;br/&gt;For V08: https://learn.microsoft.com/en-us/azure/storage/blobs/security-recommendations#:~:text=Turn%20on%20soft%20delete%20for%20blobs&lt;/p&gt;</description></item><item><title>Sensitive information definitions</title><link>https://bryanavery.co.uk/sensitive-information-definitions/</link><pubDate>Thu, 24 Nov 2022 12:20:10 +0000</pubDate><guid>https://bryanavery.co.uk/sensitive-information-definitions/</guid><description>&lt;p&gt;Sensitive information can be protected from misuse through Encryption, Pseudonymization and Anonymization controls, converting plain text to an unusable format.&lt;/p&gt;&#10;&lt;span id="more-1643"&gt;&lt;/span&gt;&#10;&lt;p&gt;Only authorized users with the proper key/source should be able to see sensitive data (or in the case of Anonymization, not at all). Each of these methods work differently, as summarized below.&lt;/p&gt;</description></item><item><title>Environment Strategy</title><link>https://bryanavery.co.uk/environment-strategy/</link><pubDate>Tue, 05 Jul 2022 08:23:28 +0000</pubDate><guid>https://bryanavery.co.uk/environment-strategy/</guid><description>&lt;h1 id="x_Overview"&gt;Overview&lt;/h1&gt;&#10;&lt;p&gt;Businesses should believe that every team is in the business of creating great customer experiences.&lt;/p&gt;&#10;&lt;p&gt;To achieve that, the application must do more than just provide control, reporting and audibility. The business needs to tap into data signals from across its business and use them to drive ongoing improvements in the products, services, and experiences they intend to deliver to its customers.&lt;/p&gt;</description></item><item><title>End of the Road For Azure DevOps?</title><link>https://bryanavery.co.uk/end-of-the-road-for-azure-devops/</link><pubDate>Tue, 03 May 2022 07:42:21 +0000</pubDate><guid>https://bryanavery.co.uk/end-of-the-road-for-azure-devops/</guid><description>&lt;p&gt;With Microsoft now owning GitHub, the technical teams have been integrated, resulting in Azure DevOps and GitHub having the same leadership and personnel. The long-term strategic direction will be GitHub, but there is no plan for Azure DevOps to go into maintenance/sunset; therefore, choosing Azure DevOps is entirely OK in short to (undefined) medium term. Azure DevOps is currently in the early stages of development. When migration tools are needed, Microsoft will give them.&lt;/p&gt;</description></item><item><title>GitHub Naming Repositories</title><link>https://bryanavery.co.uk/github-naming-repositories/</link><pubDate>Thu, 04 Nov 2021 10:43:20 +0000</pubDate><guid>https://bryanavery.co.uk/github-naming-repositories/</guid><description>&lt;p&gt;As part of our customer engagement, we have defined a naming convention for GitHub repositories. &lt;/p&gt;&#10;&lt;p&gt;We have ideas around what conventions made sense, although the type of work influences these. As we tend to spend some of your engineering time working with different languages, conventions around naming formats make sense to the engineers. These, of course, might not make sense to individuals in other fields. &lt;/p&gt;</description></item><item><title>gists</title><link>https://bryanavery.co.uk/gists/</link><pubDate>Thu, 04 Nov 2021 10:40:50 +0000</pubDate><guid>https://bryanavery.co.uk/gists/</guid><description>&lt;p&gt;GISTS – engage in chat or gossip. &lt;br/&gt;“I need a good friend I can always gist with.” &lt;/p&gt;&#10;&lt;p&gt;It is always good to chat with others, which is how we learn from each other. So why don’t project teams chat with each other? In this day and age of working from home, it is becoming more and more critical to form a social network, which helps not only with mental health but also work-related ideas and time. &lt;/p&gt;</description></item><item><title>Memory Leaks in .NET</title><link>https://bryanavery.co.uk/memory-leaks-in-net/</link><pubDate>Tue, 13 Jul 2021 11:43:49 +0000</pubDate><guid>https://bryanavery.co.uk/memory-leaks-in-net/</guid><description>&lt;p&gt;On big enterprise projects, memory leaks are like rodents in a factory. You might not notice when there are a few of them, but you always have to be on guard in case they overpopulate, infesting the factory will cause the closer and failure of the factory.&lt;/p&gt;</description></item><item><title>ILogger in .NET: best practices</title><link>https://bryanavery.co.uk/ilogger-in-net-best-practices/</link><pubDate>Fri, 23 Apr 2021 09:55:32 +0000</pubDate><guid>https://bryanavery.co.uk/ilogger-in-net-best-practices/</guid><description>&lt;p&gt;If you are like me you will have been using ILogger in DotNet Core for some time, but you’ll have noticed there are many ways to use the logger, I found this useful article by &lt;a href="https://blog.rsuter.com/" rel="noreferrer noopener" target="_blank"&gt;Rico Suter&lt;/a&gt; going over some recommendation and best practices.&lt;/p&gt;</description></item><item><title>Convert an enum to a list</title><link>https://bryanavery.co.uk/convert-an-enum-to-a-list/</link><pubDate>Mon, 01 Mar 2021 15:35:28 +0000</pubDate><guid>https://bryanavery.co.uk/convert-an-enum-to-a-list/</guid><description>&lt;p&gt;Here are various was to convert enums to a lists&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.techiedelight.com/convert-enum-to-list-csharp/" rel="noreferrer noopener" target="_blank"&gt;Original posting&lt;/a&gt; &lt;/p&gt;&#10;&lt;h3&gt;Get a List of Enum Members&lt;/h3&gt;&#10;&lt;p&gt;The idea is to use &lt;code&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.enum.getvalues" rel="noreferrer noopener" target="_blank"&gt;Enum.GetValues()&lt;/a&gt;&lt;/code&gt; method to get an array of the values of the constants in the enum. To get an &lt;code&gt;IEnumerable&amp;lt;T&amp;gt;&lt;/code&gt; of all the values in the enum, call &lt;code&gt;Cast&amp;lt;T&amp;gt;()&lt;/code&gt; on the array. To get a list, call &lt;code&gt;ToList()&lt;/code&gt; after casting.&lt;/p&gt;</description></item><item><title>Circuit Breaker</title><link>https://bryanavery.co.uk/circuit-breaker/</link><pubDate>Fri, 15 Jan 2021 10:54:58 +0000</pubDate><guid>https://bryanavery.co.uk/circuit-breaker/</guid><description>&lt;p&gt;As defined by Polly “A circuit breaker detects the level of faults in calls placed through it, and prevents calls when a configurable fault threshold is exceeded”.&lt;/p&gt;&#10;&lt;span id="more-1468"&gt;&lt;/span&gt;&#10;&lt;p&gt;The circuit breaker only makes sense when calling a less reliable API.&lt;/p&gt;</description></item><item><title>Fault tolerance using Polly</title><link>https://bryanavery.co.uk/fault-tolerance-using-polly/</link><pubDate>Mon, 09 Nov 2020 08:18:53 +0000</pubDate><guid>https://bryanavery.co.uk/fault-tolerance-using-polly/</guid><description>&lt;h2&gt;What is a Resilience Framework?&lt;/h2&gt;&#10;&lt;p&gt;Polly is classed as a resilience framework. A resilience framework is a set of libraries that help an application to recover from transient or more extended failures in services or infrastructure upon which it depends. When recovery is not possible, the resilience framework will facilitate graceful degradation of your application.&lt;/p&gt;</description></item><item><title>Throttling/Rate Limiter for an API</title><link>https://bryanavery.co.uk/throttling-rate-limiter-for-an-api/</link><pubDate>Wed, 12 Aug 2020 09:08:32 +0000</pubDate><guid>https://bryanavery.co.uk/throttling-rate-limiter-for-an-api/</guid><description>&lt;p&gt;Throttling and rate-limiting allow you to prevent abuse of your API and ensure that your API withstands large numbers of calls (including DoS and accidental loops). With Throttling, you can set a delay on calls after an SLA tier has been exceeded, slowing down the number of requests an API client is making.&lt;/p&gt;</description></item><item><title>ASP.NET Core Guidance</title><link>https://bryanavery.co.uk/asp-net-core-guidance/</link><pubDate>Tue, 30 Jun 2020 07:02:30 +0000</pubDate><guid>https://bryanavery.co.uk/asp-net-core-guidance/</guid><description>&lt;p&gt;I came across a very good article on ASP.NET Core which I needed to bookmark, as it gives a clear and understandable guidance on keeping things working as efficiently as possible.&lt;/p&gt;&#10;&lt;span id="more-1424"&gt;&lt;/span&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AspNetCoreGuidance.md"&gt;https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AspNetCoreGuidance.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Here is a copy of the post&lt;/p&gt;</description></item><item><title>JSON Web Tokens (JWT)</title><link>https://bryanavery.co.uk/json-web-tokens-jwt/</link><pubDate>Sat, 30 May 2020 15:03:56 +0000</pubDate><guid>https://bryanavery.co.uk/json-web-tokens-jwt/</guid><description>&lt;h2&gt;Overview&lt;/h2&gt;&#10;&lt;p&gt;JSON Web Tokens is an emerging standard. They are very close to their standardisation. &lt;a href="https://www.ietf.org/" rel="noreferrer noopener" target="_blank"&gt;IETF&lt;/a&gt; has taken care of that, and &lt;a href="https://openid.net/connect/" rel="noreferrer noopener" target="_blank"&gt;OpenID&lt;/a&gt; connect mandates the use of JSON Web token for all of the tokens that are exchanged in that protocol. this article gives you a little look, an overview of the purpose of security tokens, and, and what other types of tokens we have out there and where, where they are used. Then we have a look at the structure of a JSON Web Token, and then we’ll show you how easy it is to create and consume them using the Microsoft DotNet Core development framework.&lt;/p&gt;</description></item><item><title>REST Client / Server API</title><link>https://bryanavery.co.uk/rest-client-server-api/</link><pubDate>Mon, 25 May 2020 16:18:15 +0000</pubDate><guid>https://bryanavery.co.uk/rest-client-server-api/</guid><description>&lt;p&gt;Here is a simple REST Client talking to a stand along Server API all written in DotNet Core 3.1.&lt;/p&gt;&#10;&lt;p&gt;It is loosely based on creating a simple REST Client, an tutorial from Microsoft can give you the very basic features in DotNet Core&lt;br/&gt;&lt;br/&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/console-webapiclient" rel="noreferrer noopener" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/console-webapiclient&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Docker cribsheet</title><link>https://bryanavery.co.uk/docker-cribsheet/</link><pubDate>Mon, 17 Feb 2020 11:13:01 +0000</pubDate><guid>https://bryanavery.co.uk/docker-cribsheet/</guid><description>&lt;h2&gt;Build&lt;/h2&gt;&#10;&lt;p&gt;Build an image from the Dockerfile in the current directory and tag the image&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;docker build -t myimage -f Dockerfile .&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;List all images that are locally stored with the Docker Engine&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;docker ps -a&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;Delete an image from the local image store&lt;/p&gt;</description></item><item><title>NET Microservices Architecture for Containerised NET Applications</title><link>https://bryanavery.co.uk/net-microservices-architecture-for-containerised-net-applications/</link><pubDate>Wed, 12 Feb 2020 13:38:25 +0000</pubDate><guid>https://bryanavery.co.uk/net-microservices-architecture-for-containerised-net-applications/</guid><description>&lt;p&gt;I came across this guide as it is an introduction to developing microservices-based applications and managing them using containers. It discusses architectural design and implementation approaches using .NET Core and Docker containers. To make it easier to get started with containers and microservices, the guide focuses on a reference containerized and microservice-based application that you can explore. The sample application is available at the &lt;a href="https://github.com/dotnet-architecture/eShopOnContainers"&gt;eShopOnContainers&lt;/a&gt; GitHub repo. &lt;/p&gt;</description></item><item><title>event bus interface</title><link>https://bryanavery.co.uk/event-bus-interface/</link><pubDate>Wed, 12 Feb 2020 13:09:40 +0000</pubDate><guid>https://bryanavery.co.uk/event-bus-interface/</guid><description>&lt;p&gt;How do you achieve anonymity between publisher and subscriber? An easy way is to let a middleman take care of all the communication. An event bus is one such middleman.&lt;/p&gt;&#10;&lt;span id="more-1300"&gt;&lt;/span&gt;&#10;&lt;p&gt;An event bus is typically composed of two parts:&lt;/p&gt;</description></item><item><title>The Microsoft Azure Service Bus</title><link>https://bryanavery.co.uk/the-microsoft-azure-service-bus/</link><pubDate>Tue, 11 Feb 2020 08:33:47 +0000</pubDate><guid>https://bryanavery.co.uk/the-microsoft-azure-service-bus/</guid><description>&lt;p&gt;I’m going to take a high-level overview of the Microsoft Azure Service Bus. I’ll discuss briefly the four services that make up the Service Bus. &lt;/p&gt;&#10;&lt;span id="more-1274"&gt;&lt;/span&gt;&#10;&lt;p&gt;The essence of application integration is software talking to other software. But how should this communication happen? Sometimes, a direct call via API Management is perfect. In other cases, though,&lt;br/&gt; this synchronous style of communication won’t work. What if both applications aren’t available at the same time, for instance? For situations like this, an asynchronous approach is required.&lt;/p&gt;</description></item><item><title>High-performance JSON API</title><link>https://bryanavery.co.uk/high-performance-json-api/</link><pubDate>Fri, 27 Sep 2019 13:24:28 +0000</pubDate><guid>https://bryanavery.co.uk/high-performance-json-api/</guid><description>&lt;h3&gt;Raw System.Text.Json&lt;/h3&gt;&#10;&lt;p&gt;.NET Core 3.0, has shipped with the new &lt;code&gt;System.Text.Json&lt;/code&gt; APIs, which provides built-in support for JSON, including reader/writer, read-only DOM, and serializer/deserializer. With the performance, the main improvement to the methods, check and see the typical speedups of up to 2x over Json.NET.&lt;/p&gt;</description></item><item><title>Async Streams</title><link>https://bryanavery.co.uk/async-streams/</link><pubDate>Fri, 27 Sep 2019 11:20:05 +0000</pubDate><guid>https://bryanavery.co.uk/async-streams/</guid><description>&lt;p&gt;The new feature Async Streams in C# has removed the scalar result limitation and allows the async method to returns multiple results.&lt;/p&gt;&#10;&lt;p&gt;This change makes the async pattern more flexible so that you can retrieve data in lazy asynchronous sequence from a database or you can download data from an asynchronous sequence that returns the data in chunks when they become available.  &lt;/p&gt;</description></item><item><title>Cross-Site Request Forgery (CSRF)</title><link>https://bryanavery.co.uk/cross-site-request-forgery-csrf/</link><pubDate>Fri, 20 Sep 2019 10:16:13 +0000</pubDate><guid>https://bryanavery.co.uk/cross-site-request-forgery-csrf/</guid><description>&lt;div class="page" title="Page 8"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Description&lt;/h2&gt;&#10;&lt;p&gt;It is possible to trick a user into executing potentially dangerous actions against the target site due to a lack of Cross- Site-Request-Forgery (CSRF) protections. CSRF attacks are a class of confused deputy attacks that exploit the behaviour of browsers always sending authorization cookies in requests. The target site has no secure way of verifying the request was initiated from a link on a trusted domain.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;</description></item><item><title>Improper Certificate Validation</title><link>https://bryanavery.co.uk/improper-certificate-validation/</link><pubDate>Fri, 20 Sep 2019 10:10:51 +0000</pubDate><guid>https://bryanavery.co.uk/improper-certificate-validation/</guid><description>&lt;div class="page" title="Page 9"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Description&lt;/h2&gt;&#10;&lt;p&gt;The SSL Certificate Details provide information about the certificate associated with the HTTPS server. This information describes important attributes of the certificate and should be reviewed for the correctness of the contact information, whether it is self-signed, and how soon it will expire. The Supported Ciphers provides information about each available encryption scheme available for each of the possible SSL/TLS protocols.&lt;/p&gt;&#10;&lt;div class="page" title="Page 9"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Recommendations&lt;/h2&gt;&#10;&lt;p&gt;The expiration date for certificates should be monitored. New certificates should be available before the expiration date in order to maintain continuity of service and avoid downtime or displaying certificate expiration errors in users’ web browsers.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;</description></item><item><title>Server-Side Request Forgery (SSRF)</title><link>https://bryanavery.co.uk/server-side-request-forgery-ssrf/</link><pubDate>Thu, 19 Sep 2019 15:12:07 +0000</pubDate><guid>https://bryanavery.co.uk/server-side-request-forgery-ssrf/</guid><description>&lt;div class="page" title="Page 9"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Description&lt;/h2&gt;&#10;&lt;p&gt;“Server Side Request Forgery” (a.k.a. SSRF) is a class of web-application vulnerability in which an attacker can cause a website to access unintended server-side resources, including the unauthorized reading, writing, or execution of server resources.&lt;/p&gt;&#10;&lt;p&gt;Web-applications designed to pass URLs (references to server accessible content) or portions thereof, from the client browser to the application server using HTTP request parameters or HTTP request headers, are at risk for Server Side Request Forgery exploitation unless they protect against it.&lt;/p&gt;&#10;&lt;p&gt;Server-side Request Forgery (SSRF) is related to another type of vulnerability called Open Redirects in the sense that they both rely on untrusted input to reference other web-resources.&lt;/p&gt;&#10;&lt;p&gt;Strategies for avoiding and/or fixing Server-Side Request Forgery include:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Design around it&lt;/strong&gt;: Unless there is a reason why URL information must be passed, avoid the problem entirely by implementing an alternative design.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Validation&lt;/strong&gt;: When a URL value is received by the application, it must be white-list validated against the domain of possible legitimate values and rejected if it is not a member.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Indirect References&lt;/strong&gt;: In some cases, it may be possible to pass a (cryptographically strong) random value that represents the target URL and maintain a token: URL mapping on the server.  Since URLs are never passed and the tokens are (practically) un-guessable, the vulnerability is eliminated.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;If URI is hard-coded, then the attacker cannot influence where the request is going, so it would look to be a false positive. However, although some scanning software is known for false positives, you need to be careful, as most scanning software are correct in their analysis. You need to check the whole source-to-sink trace that scanning software provides? If it is reporting only that one line as the source and sink, then yes it is a false positive.&lt;/p&gt;&#10;&lt;p&gt;Useful links:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.owasp.org/index.php/Server_Side_Request_Forgery" rel="noopener" target="_blank"&gt;https://www.owasp.org/index.php/Server_Side_Request_Forgery&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt; &lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;</description></item><item><title>Improper Neutralization of CRLF Sequences in HTTP Headers</title><link>https://bryanavery.co.uk/improper-neutralization-of-crlf-sequences-in-http-headers/</link><pubDate>Thu, 19 Sep 2019 12:40:30 +0000</pubDate><guid>https://bryanavery.co.uk/improper-neutralization-of-crlf-sequences-in-http-headers/</guid><description>&lt;div class="page" title="Page 7"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Description&lt;/h2&gt;&#10;&lt;p&gt;A function call contains an HTTP response splitting flaw. Writing untrusted input into an HTTP header allows an attacker to manipulate the HTTP response rendered by the browser, leading to cache poisoning and cross-site scripting attacks.&lt;/p&gt;&#10;&lt;div class="page" title="Page 7"&gt;&#10;&lt;div class="layoutArea"&gt;&#10;&lt;div class="column"&gt;&#10;&lt;h2&gt;Recommendations&lt;/h2&gt;&#10;&lt;p&gt;Remove unexpected carriage returns and line feeds from untrusted data used to construct an HTTP response. Always validate untrusted input to ensure that it conforms to the expected format, using centralized data validation routines when possible.&lt;/p&gt;&#10;&lt;p&gt;A simple string extension can resolve this issue:&lt;/p&gt;&#10;&lt;pre class="p1"&gt;public static string&lt;span class="s1"&gt; CRLFRemoval(&lt;/span&gt;this string&lt;span class="s1"&gt; token)&lt;/span&gt;&#10;&lt;p&gt;{&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;    &lt;/span&gt;&lt;span class="s2"&gt;return&lt;/span&gt; token.Replace(&lt;span class="s3"&gt;&amp;quot;%0d&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty, StringComparison.InvariantCultureIgnoreCase)&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;                &lt;/span&gt;.Replace(&lt;span class="s3"&gt;&amp;quot;%0D&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty, StringComparison.InvariantCultureIgnoreCase)&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;                &lt;/span&gt;.Replace(&lt;span class="s3"&gt;&amp;quot;\r&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty)&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;                &lt;/span&gt;.Replace(&lt;span class="s3"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty)&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;                &lt;/span&gt;.Replace(&lt;span class="s3"&gt;&amp;quot;%0a&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty, StringComparison.InvariantCultureIgnoreCase)&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="Apple-converted-space"&gt;                &lt;/span&gt;.Replace(&lt;span class="s3"&gt;&amp;quot;%0A&amp;quot;&lt;/span&gt;, &lt;span class="s2"&gt;string&lt;/span&gt;.Empty, StringComparison.InvariantCultureIgnoreCase);&lt;/p&gt;&#10;&lt;p&gt;}&lt;/pre&gt;&lt;/p&gt;&#10;&lt;p&gt;Links for reference:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/HTTP_response_splitting" rel="noopener" target="_blank"&gt;https://en.wikipedia.org/wiki/HTTP_response_splitting&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://securiteam.com/securityreviews/5WP0E2KFGK" rel="noopener" target="_blank"&gt;https://securiteam.com/securityreviews/5WP0E2KFGK&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.owasp.org/index.php?title=Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-017)" rel="noopener" target="_blank"&gt;https://www.owasp.org/index.php?title=Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-017)&lt;/a&gt;&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;</description></item><item><title>HTTP Status Codes</title><link>https://bryanavery.co.uk/http-status-codes/</link><pubDate>Fri, 02 Nov 2018 09:11:24 +0000</pubDate><guid>https://bryanavery.co.uk/http-status-codes/</guid><description>&lt;p&gt;It is important that when writing RESTful API’s that the correct HTTP status code is returned, the best and only source of reference has to be: &lt;a href="https://httpstatuses.com/" rel="noopener" target="_blank"&gt;https://httpstatuses.com/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;span id="more-1126"&gt;&lt;/span&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;h2&gt;1×× Informational&lt;/h2&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/100"&gt;100 Continue&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/101"&gt;101 Switching Protocols&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/102"&gt;102 Processing&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;h2&gt;2×× Success&lt;/h2&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/200"&gt;200 OK&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/201"&gt;201 Created&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/202"&gt;202 Accepted&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/203"&gt;203 Non-authoritative Information&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/204"&gt;204 No Content&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/205"&gt;205 Reset Content&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/206"&gt;206 Partial Content&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/207"&gt;207 Multi-Status&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/208"&gt;208 Already Reported&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/226"&gt;226 IM Used&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;h2&gt;3×× Redirection&lt;/h2&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/300"&gt;300 Multiple Choices&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/301"&gt;301 Moved Permanently&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/302"&gt;302 Found&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/303"&gt;303 See Other&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/304"&gt;304 Not Modified&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/305"&gt;305 Use Proxy&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/307"&gt;307 Temporary Redirect&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/308"&gt;308 Permanent Redirect&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;h2&gt;4×× Client Error&lt;/h2&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/400"&gt;400 Bad Request&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/401"&gt;401 Unauthorized&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/402"&gt;402 Payment Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/403"&gt;403 Forbidden&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/404"&gt;404 Not Found&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/405"&gt;405 Method Not Allowed&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/406"&gt;406 Not Acceptable&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/407"&gt;407 Proxy Authentication Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/408"&gt;408 Request Timeout&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/409"&gt;409 Conflict&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/410"&gt;410 Gone&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/411"&gt;411 Length Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/412"&gt;412 Precondition Failed&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/413"&gt;413 Payload Too Large&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/414"&gt;414 Request-URI Too Long&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/415"&gt;415 Unsupported Media Type&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/416"&gt;416 Requested Range Not Satisfiable&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/417"&gt;417 Expectation Failed&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/418"&gt;418 I’m a teapot&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/421"&gt;421 Misdirected Request&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/422"&gt;422 Unprocessable Entity&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/423"&gt;423 Locked&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/424"&gt;424 Failed Dependency&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/426"&gt;426 Upgrade Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/428"&gt;428 Precondition Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/429"&gt;429 Too Many Requests&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/431"&gt;431 Request Header Fields Too Large&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/444"&gt;444 Connection Closed Without Response&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/451"&gt;451 Unavailable For Legal Reasons&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/499"&gt;499 Client Closed Request&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;h2&gt;5×× Server Error&lt;/h2&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/500"&gt;500 Internal Server Error&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/501"&gt;501 Not Implemented&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/502"&gt;502 Bad Gateway&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/503"&gt;503 Service Unavailable&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/504"&gt;504 Gateway Timeout&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/505"&gt;505 HTTP Version Not Supported&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/506"&gt;506 Variant Also Negotiates&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/507"&gt;507 Insufficient Storage&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/508"&gt;508 Loop Detected&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/510"&gt;510 Not Extended&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/511"&gt;511 Network Authentication Required&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://httpstatuses.com/599"&gt;599 Network Connect Timeout Error&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;</description></item><item><title>Microsoft Message Queuing</title><link>https://bryanavery.co.uk/microsoft-message-queuing/</link><pubDate>Sun, 07 Oct 2018 06:23:34 +0000</pubDate><guid>https://bryanavery.co.uk/microsoft-message-queuing/</guid><description>&lt;p&gt;MSMQ (Microsoft Message Queuing) is a message queue that is available by default as part of Windows. A reliable way of sending and receiving messages across computer systems, MSMQ provides a queue that’s scalable, thread-safe, simple, and convenient to use while at the same time providing you with the opportunity to persist the messages inside the Windows database.&lt;span id="more-1021"&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to handle Events between Applications</title><link>https://bryanavery.co.uk/how-to-handle-events-between-applications/</link><pubDate>Fri, 24 Aug 2018 06:16:25 +0000</pubDate><guid>https://bryanavery.co.uk/how-to-handle-events-between-applications/</guid><description>&lt;h2&gt;The problem?&lt;/h2&gt;&#10;&lt;p&gt;How can application A, handle events sent by an application B, and how to implements those events in B? Knowing that B has no idea of the existence of A.&lt;br/&gt;&#10;&lt;span id="more-1014"&gt;&lt;/span&gt;&lt;/p&gt;&#10;&lt;h2&gt;The MemoryMapped way&lt;/h2&gt;&#10;&lt;p&gt;The following example shows how it would work, with the restriction that both applications are using the same memory space. In real code, the &lt;code&gt;producer()&lt;/code&gt; method would be in a different application from the &lt;code&gt;consumer()&lt;/code&gt; method, but this serves to illustrate an implementation:&lt;/p&gt;</description></item><item><title>Break apart the connection string</title><link>https://bryanavery.co.uk/break-apart-the-connection-string/</link><pubDate>Tue, 31 Jul 2018 07:35:23 +0000</pubDate><guid>https://bryanavery.co.uk/break-apart-the-connection-string/</guid><description>&lt;p&gt;It is sometimes useful to know which database you are connected to, here is a simple method that pulls apart the connection string and provides you with the section you request.&lt;span id="more-992"&gt;&lt;/span&gt;&lt;/p&gt;&#10;&lt;pre&gt;private static string GetSection(string section)&#10;{&#10;var connectionString = string.Empty;&#10;&lt;p&gt;Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(&amp;quot;/MyWebSiteRoot&amp;quot;);&#10;ConnectionStringSettings connString;&lt;/p&gt;&#10;&lt;p&gt;if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count &amp;gt; 0)&#10;{&#10;connString = rootWebConfig.ConnectionStrings.ConnectionStrings[&amp;ldquo;Entities&amp;rdquo;];&#10;if (connString != null)&#10;connectionString = connString.ConnectionString;&#10;}&lt;/p&gt;&#10;&lt;p&gt;string[] parts = connectionString.Split(&amp;rsquo;;&amp;rsquo;);&lt;/p&gt;&#10;&lt;p&gt;for (int i = 0; i &amp;lt; parts.Length; i++)&#10;{&#10;string part = parts[i].Trim().ToLowerInvariant();&#10;if (part.StartsWith($&amp;quot;{section}=&amp;quot;))&#10;{&#10;return part.Replace($&amp;quot;{section}=&amp;quot;, &amp;ldquo;&amp;rdquo;);&#10;}&#10;}&lt;/p&gt;&#10;&lt;p&gt;return &amp;ldquo;Unknown&amp;rdquo;;&#10;}&lt;/pre&gt;</description></item><item><title>Creating API Help Pages</title><link>https://bryanavery.co.uk/creating-api-help-pages/</link><pubDate>Tue, 15 May 2018 08:51:00 +0000</pubDate><guid>https://bryanavery.co.uk/creating-api-help-pages/</guid><description>&lt;p class=""&gt;Install &lt;a class="" data-linktype="external" href="https://go.microsoft.com/fwlink/?LinkId=282650"&gt;ASP.NET and Web Tools 2012.2 Update&lt;/a&gt;. This update integrates help pages into the Web API project template.&lt;/p&gt;&#10;&lt;p&gt;Next, create a new ASP.NET MVC 4 project and select the Web API project template. The project template creates an example API controller named &lt;code&gt;ValuesController&lt;/code&gt;. The template also creates the API help pages. All of the code files for the help page are placed in the Areas folder of the project.&lt;/p&gt;</description></item><item><title>Bing Maps in an MVC Application</title><link>https://bryanavery.co.uk/bing-maps-in-an-mvc-application/</link><pubDate>Tue, 01 May 2018 07:40:41 +0000</pubDate><guid>https://bryanavery.co.uk/bing-maps-in-an-mvc-application/</guid><description>&lt;p&gt;Here is a simple example of how to use Bing Maps in an MVC application.&lt;/p&gt;&#10;&lt;p&gt;I am using Bing Maps V8 which is the current version of Microsoft.&lt;/p&gt;&#10;&lt;p&gt;Also, nothing that document.ready will fire long before the map script loads as it loads asynchronously.  Sometimes document.ready will fire before the page is loaded which means the map div might not even be available. To overcome this, we are using the callback parameter of the map script UR: for example:&lt;/p&gt;</description></item><item><title>Caching to improve the user experience</title><link>https://bryanavery.co.uk/caching-to-improve-the-user-experence/</link><pubDate>Thu, 26 Apr 2018 10:16:47 +0000</pubDate><guid>https://bryanavery.co.uk/caching-to-improve-the-user-experence/</guid><description>&lt;p&gt;(Added LazyCache in to the Testing)&lt;/p&gt;&#10;&lt;p&gt;One of the essential factors in building high-performance, scalable Web applications is the ability to store items, whether data objects, pages, or even parts of a page in memory the initial time they are requested. You can save these items on the Web server or other software in the request stream, such as a proxy server or at the browser. This allows you to avoid recreating information that satisfied a previous request. Known as caching, it will enable you to use many techniques to store page output or application data across HTTP requests and reuse it. When the server does not have to recreate information you save time and resources, and throughput and scalability increase.&lt;/p&gt;</description></item><item><title>Repository Pattern – for the REST API</title><link>https://bryanavery.co.uk/repository-pattern-for-the-rest-api/</link><pubDate>Fri, 06 Apr 2018 13:51:23 +0000</pubDate><guid>https://bryanavery.co.uk/repository-pattern-for-the-rest-api/</guid><description>&lt;p&gt;The Repository Pattern used to be the next big thing when it was used, but over time it got replaced by frameworks such as the Entity Framework and LINQ, which provided much more functionality and flexibility.&lt;/p&gt;</description></item><item><title>Timeout Process</title><link>https://bryanavery.co.uk/timeout-process/</link><pubDate>Fri, 23 Feb 2018 08:10:48 +0000</pubDate><guid>https://bryanavery.co.uk/timeout-process/</guid><description>&lt;p&gt;When you are dealing with large amounts of data or processes that are very time hungry you sometimes need the ability to timeout that task and continue.&lt;/p&gt;&#10;&lt;p&gt;Here is a snippet of code that loops around that takes 1 second, and you can set a timeout to any time you like, but if it is less than 1 second, it will cancel the task and free up resources.&lt;/p&gt;</description></item><item><title>Differences Between ASMX and WCF Services</title><link>https://bryanavery.co.uk/differences-between-asmx-and-wcf-services/</link><pubDate>Tue, 16 Jan 2018 07:32:51 +0000</pubDate><guid>https://bryanavery.co.uk/differences-between-asmx-and-wcf-services/</guid><description>&lt;p&gt;Some differences between ASMX and WCF services are subtle and some differences between them are not subtle. The purpose of this section is to identify many of these differences and to provide guidance for how to handle them when preparing for, or when performing, migration. ASMX provides a very successful baseline for services, and WCF extends those capabilities for the next generation of services.&lt;/p&gt;</description></item><item><title>Defining and Using Custom Attribute Classes in C#</title><link>https://bryanavery.co.uk/defining-and-using-custom-attribute-classes-in-c/</link><pubDate>Wed, 10 Jan 2018 08:41:27 +0000</pubDate><guid>https://bryanavery.co.uk/defining-and-using-custom-attribute-classes-in-c/</guid><description>&lt;p&gt;Attributes are advantageous in C# to provide none business-related functionality in an application or to abstract out the code to make it easier to follow.&lt;/p&gt;&#10;&lt;p&gt;The issue is when does the attribute code get called and how do you force it to run?&lt;/p&gt;</description></item><item><title>Parse JSON into a C# Object</title><link>https://bryanavery.co.uk/parse-json-into-a-c-object/</link><pubDate>Thu, 09 Nov 2017 09:17:41 +0000</pubDate><guid>https://bryanavery.co.uk/parse-json-into-a-c-object/</guid><description>&lt;p&gt;Let’s start with a simple JSON string. In most cases, you will get this string from a web service call. For the sake of this tutorial, we will do this manually.&lt;/p&gt;&#10;&lt;pre&gt;&lt;code class="hljs actionscript"&gt;&lt;span class="hljs-keyword"&gt;var&lt;/span&gt; example1 = @&lt;span class="hljs-string"&gt;"{"&lt;/span&gt;&lt;span class="hljs-string"&gt;"name"&lt;/span&gt;&lt;span class="hljs-string"&gt;":"&lt;/span&gt;&lt;span class="hljs-string"&gt;"John Doe"&lt;/span&gt;&lt;span class="hljs-string"&gt;","&lt;/span&gt;&lt;span class="hljs-string"&gt;"age"&lt;/span&gt;&lt;span class="hljs-string"&gt;":20}"&lt;/span&gt;;&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;&lt;code&gt;example1&lt;/code&gt; is a simple JSON object with 2 fields: name and age.&lt;/p&gt;</description></item><item><title>Symmetric encryption/decryption routine using AES</title><link>https://bryanavery.co.uk/symmetric-encryptiondecryption-routine-using-aes/</link><pubDate>Mon, 24 Jul 2017 15:40:48 +0000</pubDate><guid>https://bryanavery.co.uk/symmetric-encryptiondecryption-routine-using-aes/</guid><description>&lt;p&gt;The following is a symmetric encryption/decryption routine using AES in GCM mode. This code operates in the application layer and is meant to receive user-specific and confidential information and encrypt it, after which it is stored in a separate database server. It also is called upon to decrypt encrypted information from the database.&lt;/p&gt;</description></item><item><title>Database Layer</title><link>https://bryanavery.co.uk/database-layer/</link><pubDate>Mon, 24 Jul 2017 15:39:35 +0000</pubDate><guid>https://bryanavery.co.uk/database-layer/</guid><description>&lt;p&gt;The DatabaseLayer is an abstraction for database access which means the calling application or library does not need to be tight-coupled to the database itself. A set of factory methods is available to call in order to create commands and parameters, all based on the .NET abstract base classes.&lt;/p&gt;</description></item><item><title>Azure Key Vault</title><link>https://bryanavery.co.uk/azure-key-vault/</link><pubDate>Fri, 23 Jun 2017 08:42:47 +0000</pubDate><guid>https://bryanavery.co.uk/azure-key-vault/</guid><description>&lt;p&gt;This is how, within your organisation, you can protect the data, especially in a cloud-first, multi-tenant world. The source will provide you with the concepts around encrypting enterprise data, look at what you should encrypt, and cover robust patterns and practices you can follow in your organisation.&lt;/p&gt;</description></item><item><title>Cryptography .NET, Avoiding Timing Attack</title><link>https://bryanavery.co.uk/cryptography-net-avoiding-timing-attack/</link><pubDate>Tue, 06 Jun 2017 14:13:49 +0000</pubDate><guid>https://bryanavery.co.uk/cryptography-net-avoiding-timing-attack/</guid><description>&lt;p&gt;When comparing two MACs or hashes (also password hashes) for equality you would first think a simple comparison would be okay?  Think again as they are susceptible to timing attacks.&lt;/p&gt;&#10;&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;In cryptography, a timing attack is a side channel attack in which the attacker attempts to compromise a cryptosystem by analysing the time taken to execute cryptographic algorithms.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>SecureString</title><link>https://bryanavery.co.uk/securestring/</link><pubDate>Fri, 02 Jun 2017 14:51:58 +0000</pubDate><guid>https://bryanavery.co.uk/securestring/</guid><description>&lt;p&gt;I’ve come across a class in the System.Security namespace that is often overlooked. The class is SecureString. In this post, I will go over what SecureString is and why it is needed.&lt;/p&gt;&#10;&lt;p&gt;Have you ever come across these scenarios before?&lt;/p&gt;</description></item><item><title>Raising Multiple Exceptions with AggregateException</title><link>https://bryanavery.co.uk/raising-multiple-exceptions-with-aggregateexception/</link><pubDate>Wed, 24 May 2017 08:58:31 +0000</pubDate><guid>https://bryanavery.co.uk/raising-multiple-exceptions-with-aggregateexception/</guid><description>&lt;p&gt;There are occasions where you are aware of many exceptions within your code that you want to raise together in one go. Perhaps your system makes a service call to a middleware orchestration component that potentially returns many exceptions detailed in its response, or another scenario might be a batch processing task dealing with many items in one process that require you to collate all exceptions until the end and then throw them together.&lt;/p&gt;</description></item><item><title>Using MongoDB</title><link>https://bryanavery.co.uk/using-mongodb/</link><pubDate>Tue, 16 May 2017 13:33:30 +0000</pubDate><guid>https://bryanavery.co.uk/using-mongodb/</guid><description>&lt;p&gt;If you want to setup MongoDB with C#, then the best option is to follow the getting started guide on the MongoDB website&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://docs.mongodb.com/getting-started/csharp/client/" rel="noopener noreferrer" target="_blank"&gt;https://docs.mongodb.com/getting-started/csharp/client/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;You can install the NuGet package for MongoDB by typing into the Package Manager Console&lt;/p&gt;</description></item><item><title>Custom Configuration in your config</title><link>https://bryanavery.co.uk/custom-configuration-in-your-config/</link><pubDate>Wed, 10 May 2017 09:41:18 +0000</pubDate><guid>https://bryanavery.co.uk/custom-configuration-in-your-config/</guid><description>&lt;p&gt;This post is to show how to setup a customised configuration section in your app.config or web.conifg of your .NET application&lt;/p&gt;&#10;&lt;p&gt;I have written an &lt;a href="https://bryanavery.co.uk/index.html%3Fp=318.html" rel="noopener noreferrer" target="_blank"&gt;article&lt;/a&gt; on this before, back in 2008, but things have moved on in the libraries and this is the latest and easiest way to create your own customised configuration.&lt;/p&gt;</description></item><item><title>New Features in C# 7.0</title><link>https://bryanavery.co.uk/new-features-in-c-7-0/</link><pubDate>Fri, 24 Mar 2017 23:35:31 +0000</pubDate><guid>https://bryanavery.co.uk/new-features-in-c-7-0/</guid><description>&lt;p&gt;Microsoft have release C# 7.0 and it comes with a number of new features and brings a focus on data consumption, code simplification and performance. Tuples have been around for a while but they have made them so much easier to use, which make it easy to have multiple results, and pattern matching which simplifies code that is conditional on the shape of data. But there are many other features big and small.&lt;/p&gt;</description></item><item><title>How slow are Exceptions</title><link>https://bryanavery.co.uk/how-slow-are-exceptions/</link><pubDate>Fri, 16 Dec 2016 09:23:50 +0000</pubDate><guid>https://bryanavery.co.uk/how-slow-are-exceptions/</guid><description>&lt;p&gt;I’ve seen from time to time applications that wrap a TRY – CATCH around some code, but do nothing except carry on.  So why is this so wrong?&lt;/p&gt;&#10;&lt;p&gt;As programmers we want to write quality code that solves problems. Unfortunately, exceptions come as side effects of our code. No one likes side effects, so we soon find our own ways to get around them. I have seen some smart programmers deal with exceptions the following way:&lt;/p&gt;</description></item><item><title>Entity Framework Unit of Work Patterns</title><link>https://bryanavery.co.uk/entity-framework-unit-of-work-patterns/</link><pubDate>Tue, 13 Dec 2016 13:53:30 +0000</pubDate><guid>https://bryanavery.co.uk/entity-framework-unit-of-work-patterns/</guid><description>&lt;p&gt;I’m not often shocked, but when I found out that Entity Framework was not thread safe, I was horrified.  I even had to buy a fellow college dinner as I lost a bet.&lt;/p&gt;&#10;&lt;p&gt;Now that I knew what the problem was how can it be resolved?&lt;/p&gt;</description></item><item><title>Decorator Pattern</title><link>https://bryanavery.co.uk/decorator-pattern/</link><pubDate>Mon, 12 Dec 2016 09:26:09 +0000</pubDate><guid>https://bryanavery.co.uk/decorator-pattern/</guid><description>&lt;p&gt;Decorator pattern falls under Structural Pattern of Gang of Four (GOF) Design Patterns in .Net. Decorator pattern is used to add new functionality to an existing object without changing its structure. Hence Decorator pattern provides an alternative way to inheritance for modifying the behavior of an object. In this article, I would like to go over what the decorator pattern can do, and how it works.&lt;/p&gt;</description></item><item><title>Kendo Grid custom sort order</title><link>https://bryanavery.co.uk/kendo-grid-custom-sort-order/</link><pubDate>Thu, 08 Dec 2016 16:51:32 +0000</pubDate><guid>https://bryanavery.co.uk/kendo-grid-custom-sort-order/</guid><description>&lt;p&gt;I’ve been racking my brains as the sorting on the Kendo Grid is pretty good, only that I need to be able to not sort in the order that is being displayed.  An example would be numbers written out in full and you want them in number sort order.&lt;/p&gt;</description></item><item><title>Code Metrics what do they mean?</title><link>https://bryanavery.co.uk/code-metrics-what-do-they-mean/</link><pubDate>Wed, 30 Nov 2016 16:53:53 +0000</pubDate><guid>https://bryanavery.co.uk/code-metrics-what-do-they-mean/</guid><description>&lt;p&gt; &lt;/p&gt;&#10;&lt;p&gt;&lt;b&gt;Code metrics&lt;/b&gt; is a set of software measures that provide developers better insight into the &lt;b&gt;code&lt;/b&gt; they are developing. By taking advantage of &lt;b&gt;code metrics&lt;/b&gt;, developers can understand which types and/or methods should be reworked or more thoroughly tested.&lt;/p&gt;</description></item><item><title>IoC Benchmark</title><link>https://bryanavery.co.uk/ioc-benchmark/</link><pubDate>Wed, 30 Nov 2016 16:22:37 +0000</pubDate><guid>https://bryanavery.co.uk/ioc-benchmark/</guid><description>&lt;p&gt;So which is the fastest at different IoC Lifestyles.&lt;/p&gt;&#10;&lt;p&gt;In this benchmark we will be running, head to had, with Castle Windsor, Ninject, Spring.NET, Unity, Microsoft DI, AutoFac, and Structure Map.&lt;/p&gt;&#10;&lt;p&gt;Here is a working project, this uses NuGet to included the packages, so as time goes on you may find the packages go out of date, so you’ll need to refactor the code to work with the next packages.&lt;/p&gt;</description></item><item><title>Factory Support Facility</title><link>https://bryanavery.co.uk/factory-support-facility/</link><pubDate>Mon, 28 Nov 2016 13:40:47 +0000</pubDate><guid>https://bryanavery.co.uk/factory-support-facility/</guid><description>&lt;p&gt;Factory Support Facility allows using factories to create components. This is beneficial when you want to make available as services components that do not have accessible constructor, or that you don’t instantiate, like HttpContext.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Prefer UsingFactoryMethod over this facility:&lt;/strong&gt; while the facility provides programmatic API it is deprecated and its usage is discouraged and won’t be discussed here. Recommended approach is to use &lt;a href="https://github.com/castleproject/Windsor/blob/master/docs/registering-components-one-by-one.md#using-a-delegate-as-component-factory"&gt;&lt;span style="color: #3366ff;"&gt;UsingFactoryMethod&lt;/span&gt;&lt;/a&gt; method of&lt;a href="https://github.com/castleproject/Windsor/blob/master/docs/fluent-registration-api.md"&gt;&lt;span style="color: #3366ff;"&gt; fluent registration API&lt;/span&gt;&lt;/a&gt; to create components. This limits the usefulness of the facility to XML-driven and legacy scenarios.&lt;/p&gt;</description></item><item><title>Registering components for IoC</title><link>https://bryanavery.co.uk/registering-components-for-ioc/</link><pubDate>Mon, 28 Nov 2016 13:32:45 +0000</pubDate><guid>https://bryanavery.co.uk/registering-components-for-ioc/</guid><description>&lt;p&gt;Inversion of Control (IoC) is quite a big step for some developers, but the benefits once implemented are huge.  With the applications performance, maintainability, unit testing and more importantly separation of concerns, just to name a few.&lt;/p&gt;</description></item><item><title>Introduction to IoC with Windsor</title><link>https://bryanavery.co.uk/introduction-to-ioc-with-windsor/</link><pubDate>Mon, 28 Nov 2016 09:15:00 +0000</pubDate><guid>https://bryanavery.co.uk/introduction-to-ioc-with-windsor/</guid><description>&lt;p&gt;I do love &lt;a href="https://bryanavery.co.uk/index.html%3Fp=158.html"&gt;&lt;strong&gt;&lt;span style="color: #4e4e4e;"&gt;dependency injection&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;, but many developers still seem to miss the point and the reason for having it. If you’re only using it on a small scale, you don’t really need any tools to use the technique. But once you’re used to this design technique, you’ll quickly start using it in many places of your code. If you do, it quickly becomes cumbersome to deal with the real instances of your runtime dependencies manually. This is where tools like Inversion Of Control (IoC) containers come in to play. There are a few solid containers available for the .NET world, and even Microsoft has released their &lt;a href="http://www.codeplex.com/unity" target="_blank"&gt;&lt;strong&gt;&lt;span style="color: #4e4e4e;"&gt;own container&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;. Basically, what the IoC container does for you, is take care of providing dependencies to components in a flexible and customizable way. It allows clients to remain completely oblivious to the dependencies of components they use. This makes it easy to change components without having to modify client code. Not to mention the fact that your components are a lot easier to test, since you can simply inject fake dependencies during your tests.&lt;/p&gt;</description></item><item><title>How to Rank your search results with multiple search terms using LINQ and EntityFramework</title><link>https://bryanavery.co.uk/how-to-rank-your-search-results-with-multiple-search-terms-using-linq-and-entityframework/</link><pubDate>Tue, 31 Dec 2013 11:59:00 +0000</pubDate><guid>https://bryanavery.co.uk/how-to-rank-your-search-results-with-multiple-search-terms-using-linq-and-entityframework/</guid><description>&lt;p&gt;I have always used a ranked search criteria, it’s the only true way to get good results back from a data set.  But I’ve been doing my ranking within C# code.  But this got all the data from the data source and then ranked the results.  This is very poor on performance, as we should only be returning back the results for the page size we require.&lt;/p&gt;</description></item><item><title>Make Fake MVC Objects for testing</title><link>https://bryanavery.co.uk/make-fake-mvc-objects-for-testing/</link><pubDate>Thu, 19 Dec 2013 11:53:00 +0000</pubDate><guid>https://bryanavery.co.uk/make-fake-mvc-objects-for-testing/</guid><description>&lt;p&gt;If you need to create some Fake MVC objects for testing MVC objects then here you are:&lt;/p&gt;&#10;&lt;h2&gt;FakeControllerContext&lt;/h2&gt;&#10;&lt;pre class="brush: c-sharp;"&gt;using System.Collections.Specialized;&#10;using System.Web;&#10;using System.Web.Mvc;&#10;using System.Web.Routing;&#10;using System.Web.SessionState;&#10;&lt;p&gt;using MvcContrib.TestHelper.Fakes;&lt;/p&gt;&#10;&lt;p&gt;public class FakeControllerContext : ControllerContext&#10;{&#10;public FakeControllerContext(IController controller)&#10;: this(controller, null, null, null, null, null, null)&#10;{&#10;}&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;public FakeControllerContext(IController controller, HttpCookieCollection cookies)&#10; : this(controller, null, null, null, null, cookies, null)&#10;{&#10;}&#10;&#10;public FakeControllerContext(IController controller, SessionStateItemCollection sessionItems)&#10; : this(controller, null, null, null, null, null, sessionItems)&#10;{&#10;}&#10; &#10;public FakeControllerContext(IController controller, NameValueCollection formParams)&#10; : this(controller, null, null, formParams, null, null, null)&#10;{&#10;}&#10; &#10;public FakeControllerContext(IController controller, NameValueCollection formParams, NameValueCollection queryStringParams)&#10; : this(controller, null, null, formParams, queryStringParams, null, null)&#10;{&#10;}&#10; &#10;public FakeControllerContext(IController controller, string userName)&#10; : this(controller, userName, null, null, null, null, null)&#10;{&#10;}&#10; &#10;public FakeControllerContext(IController controller, string userName, string[] roles)&#10; : this(controller, userName, roles, null, null, null, null)&#10;{&#10;}&#10; &#10;public FakeControllerContext&#10; (&#10; IController controller,&#10; string userName,&#10; string[] roles,&#10; NameValueCollection formParams,&#10; NameValueCollection queryStringParams,&#10; HttpCookieCollection cookies,&#10; SessionStateItemCollection sessionItems&#10; )&#10; : base(new FakeHttpContext(new FakePrincipal(new FakeIdentity(userName), roles), formParams, queryStringParams, cookies, sessionItems), new RouteData(), (Controller)controller)&#10;{ }&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;}&lt;/pre&gt;</description></item><item><title>Disclaimer Page using MVC</title><link>https://bryanavery.co.uk/disclaimer-page-using-mvc/</link><pubDate>Wed, 18 Dec 2013 13:17:00 +0000</pubDate><guid>https://bryanavery.co.uk/disclaimer-page-using-mvc/</guid><description>&lt;p&gt;If you ever need a disclaimer page in MVC, there are a few things you need to consider, the first is you should not be able to get to a page without agreeing to the disclaimer and if you have to re-login then you need to be presented with the disclaimer page again.&lt;/p&gt;</description></item><item><title>Unit Testing a Private Method</title><link>https://bryanavery.co.uk/unit-testing-a-private-method/</link><pubDate>Tue, 17 Dec 2013 11:11:00 +0000</pubDate><guid>https://bryanavery.co.uk/unit-testing-a-private-method/</guid><description>&lt;p&gt;With Visual Studio keep changing the way you create unit tests I thought I’d document down how to test a private method the easy way.&lt;/p&gt;&#10;&lt;p&gt;Here is a simple HomeController and we want to test that the GetPageSize method return 20 in a unit test.&lt;/p&gt;</description></item><item><title>URL Activity Tampering and how to prevent it in MVC</title><link>https://bryanavery.co.uk/url-activity-tampering-and-how-to-prevent-it-in-mvc/</link><pubDate>Wed, 30 Oct 2013 13:04:00 +0000</pubDate><guid>https://bryanavery.co.uk/url-activity-tampering-and-how-to-prevent-it-in-mvc/</guid><description>&lt;p&gt;No web applications are developed without concerning the security issues. But it is not sure whether the security measures are implemented correctly and the applications are well protected. We could see a lot of web applications query string parameters in plain string which are easy to manipulate and way to escalate restricted resources. Even the URL parameters are encrypted there is still a chance of a bruteforce attack by manipulating the encrypted hash and it yields when the database is large where the chance of matching a random hash is high. So it is clear the importance to protect the URL in the web application is necessary for all programming platforms. Here, this is discussed with reference to ASP.NET MVC and the utility class is presented.&lt;/p&gt;</description></item><item><title>Clean Content to help searching</title><link>https://bryanavery.co.uk/clean-content-to-help-searching/</link><pubDate>Mon, 28 Oct 2013 11:43:00 +0000</pubDate><guid>https://bryanavery.co.uk/clean-content-to-help-searching/</guid><description>&lt;p&gt;One of the issue we all faced with is when a user searches for content, we are allowing the end user to be able to search for anything and this could result in unnecessary searching or cause the backend to perform searches which could result in DOS attacks via SQL.&lt;/p&gt;</description></item><item><title>URL Validator</title><link>https://bryanavery.co.uk/url-validator/</link><pubDate>Fri, 25 Oct 2013 08:14:00 +0000</pubDate><guid>https://bryanavery.co.uk/url-validator/</guid><description>&lt;p&gt;I needed to check to see if a URL that the user was entering was a valid Url, does it contain HTTP:// or HTTPS:// I ended up writing a small ValidationAttribute to add to the collection I am now building up, here is the code:&lt;/p&gt;</description></item><item><title>Removing and Cleaning search content to prevent DoS attacks</title><link>https://bryanavery.co.uk/removing-and-cleaning-search-content-to-prevent-dos-attacks/</link><pubDate>Tue, 08 Oct 2013 14:37:00 +0000</pubDate><guid>https://bryanavery.co.uk/removing-and-cleaning-search-content-to-prevent-dos-attacks/</guid><description>&lt;p&gt;There are many ways to search a system, what we have to be careful of is making sure that the search does not cause a DoS (Denial of Service) attack.&lt;/p&gt;&#10;&lt;p&gt;So following on from my article &lt;a href="https://bryanavery.co.uk/post/2013/10/01/Denial-Of-Service-attacks-via-SQL-Wildcards-should-be-prevented/" target="_blank"&gt;Denial Of Service (DoS) attacks via SQL Wildcards&lt;/a&gt; should be prevented here is a method to remove and clean up the search to prevent such an attack.&lt;/p&gt;</description></item><item><title>MVC way to check the File Extension</title><link>https://bryanavery.co.uk/mvc-way-to-check-the-file-extension/</link><pubDate>Fri, 04 Oct 2013 10:07:00 +0000</pubDate><guid>https://bryanavery.co.uk/mvc-way-to-check-the-file-extension/</guid><description>&lt;p&gt;Following on from my article about checking for the &lt;a href="https://bryanavery.co.uk/post/2013/06/25/Determine-which-file-type-has-been-uploaded/"&gt;file signature&lt;/a&gt; to ensure that the file is who it says it is&lt;/p&gt;&#10;&lt;p&gt;I decide to take it further and produce a Data Validation attribute, I found that the Microsoft.Web.Mvc.dll library already has one ,but it only checks for the file names, which is generally okay.&lt;/p&gt;</description></item><item><title>File Upload does not check content</title><link>https://bryanavery.co.uk/file-upload-does-not-check-content/</link><pubDate>Thu, 03 Oct 2013 12:30:00 +0000</pubDate><guid>https://bryanavery.co.uk/file-upload-does-not-check-content/</guid><description>&lt;p&gt;Is it possible to upload files of any type to the server through web application’s functionality?&lt;/p&gt;&#10;&lt;p&gt;Only file extension restrictions were could be enforced and the server may not perform any content checking (apart from possible anti-virus checks).&lt;/p&gt;</description></item><item><title>SSL Vulnerable to BEAST attack</title><link>https://bryanavery.co.uk/ssl-vulnerable-to-beast-attack/</link><pubDate>Thu, 03 Oct 2013 09:31:00 +0000</pubDate><guid>https://bryanavery.co.uk/ssl-vulnerable-to-beast-attack/</guid><description>&lt;p&gt;A vulnerability exists in SSL 3.0 and TLS 1.0 that could allow information disclosure if an attacker intercepts encrypted traffic served from an affected system. The weakness is down to insufficiently randomised data being used for the Initialisation Vectors (IV) within the CBC-mode encryption algorithms. The exploit can be performed through multiple injection points, both native to the browser’s functionality.&lt;/p&gt;</description></item><item><title>Verbose Error Messages</title><link>https://bryanavery.co.uk/verbose-error-messages/</link><pubDate>Thu, 03 Oct 2013 09:25:00 +0000</pubDate><guid>https://bryanavery.co.uk/verbose-error-messages/</guid><description>&lt;p&gt;The software generates an error message that includes sensitive information about its environment, users, or associated data.  &lt;/p&gt;&#10;&lt;h2&gt;Extended Description&lt;/h2&gt;&#10;&lt;p&gt;The sensitive information may be valuable information on its own (such as a password), or it may be useful for launching other, more deadly attacks. If an attack fails, an attacker may use error information provided by the server to launch another more focused attack. For example, an attempt to exploit a path traversal weakness might yield the full pathname of the installed application. In turn, this could be used to select the proper number of “..” sequences to navigate to the targeted file. An attack using SQL injection might not initially succeed, but an error message could reveal the malformed query, which would expose query logic and possibly even passwords or other sensitive information used within the query. &lt;/p&gt;</description></item><item><title>Environment issue – Untrusted Certificate</title><link>https://bryanavery.co.uk/environment-issue-untrusted-certificate/</link><pubDate>Thu, 03 Oct 2013 09:12:00 +0000</pubDate><guid>https://bryanavery.co.uk/environment-issue-untrusted-certificate/</guid><description>&lt;p&gt;Certificate is singed by an unrecognised certificate authority.  If a browser receives a self-signed certificate, it pops up a warning, and the burden falls to the user to confirm the identity.  Pushing this decision to the user is ultimately what opens up the possibility of a man-in-the-middle (MITM) attack.  The security issue is not with self-signed certificates, but with the way users interact with them in the browser.&lt;/p&gt;</description></item><item><title>Denial Of Service (DoS) attacks via SQL Wildcards should be prevented</title><link>https://bryanavery.co.uk/denial-of-service-dos-attacks-via-sql-wildcards-should-be-prevented/</link><pubDate>Tue, 01 Oct 2013 14:21:00 +0000</pubDate><guid>https://bryanavery.co.uk/denial-of-service-dos-attacks-via-sql-wildcards-should-be-prevented/</guid><description>&lt;p&gt;SQL Wildcard attacks force the underlying database to carry out CPU-intensive queries by using several wildcards. This vulnerability generally exists in search functionalities of web applications. Successful exploitation of this attack will cause Denial of Service (DoS).&lt;/p&gt;</description></item><item><title>HTTP Header Disclosure</title><link>https://bryanavery.co.uk/http-header-disclosure/</link><pubDate>Tue, 01 Oct 2013 13:26:00 +0000</pubDate><guid>https://bryanavery.co.uk/http-header-disclosure/</guid><description>&lt;h2&gt;Vulnerability overview/description&lt;/h2&gt;&#10;&lt;p&gt;Due to unsanitized user input it is possible to inject arbitrary HTTP header values in certain HTTP responses of the Satellite Server. This can be exploited, for example, to perform session fixation and malicious redirection attacks via the Set-Cookie and the Refresh headers. Moreover, the Satellite Server caches these HTTP responses with the injected HTTP header resulting in all further requests to the same resource being served with the poisoned HTTP response, while these objects remain in cache. &lt;/p&gt;</description></item><item><title>User Enumeration – Login failure messages shouldn’t give out any information that results in vulnerabilities.</title><link>https://bryanavery.co.uk/user-enumeration-login-failure-messages-shouldnt-give-out-any-information-that-results-in-vulnerabilities/</link><pubDate>Tue, 01 Oct 2013 11:35:00 +0000</pubDate><guid>https://bryanavery.co.uk/user-enumeration-login-failure-messages-shouldnt-give-out-any-information-that-results-in-vulnerabilities/</guid><description>&lt;p&gt;Is it possible to enumerate user account details within the Web application via the logon page?&lt;/p&gt;&#10;&lt;p&gt;Where an application requires account details to retrieve other information, it may be possible to enumerate the details based on the error message returned by the application.&lt;/p&gt;</description></item><item><title>PenTest where to start</title><link>https://bryanavery.co.uk/pentest-where-to-start/</link><pubDate>Tue, 01 Oct 2013 10:35:00 +0000</pubDate><guid>https://bryanavery.co.uk/pentest-where-to-start/</guid><description>&lt;p&gt;I would like to secure up an MVC application, and one way of insuring a secure application is to run through pentesting, Penetration Testing, but what is pentesting?&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Penetration_test" target="_blank"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;A penetration test, occasionally pentest, is a method of evaluating computer and network security by simulating an attack on a computer system or network from external and internal threats. The process involves an active analysis of the system for any potential vulnerabilities that could result from poor or improper system configuration, both known and unknown hardware or software flaws, or operational weaknesses in process or technical countermeasures. This analysis is carried out from the position of a potential attacker and can involve active exploitation of security vulnerabilities.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Elmah or Microsoft Enterprise Library for Exception logging</title><link>https://bryanavery.co.uk/elmah-or-microsoft-enterprise-library-for-exception-logging/</link><pubDate>Thu, 29 Aug 2013 16:21:00 +0000</pubDate><guid>https://bryanavery.co.uk/elmah-or-microsoft-enterprise-library-for-exception-logging/</guid><description>&lt;p&gt; &lt;/p&gt;&#10;&lt;p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;strong&gt;&lt;span style="font-size: 12.0pt; font-family: 'Times New Roman','serif'; mso-fareast-language: EN-GB;"&gt;Enterprise Library Logging Application Block&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;The Enterprise Library Logging Application Block simplifies the implementation of common logging functions. You can use the Logging Application Block to write information to a variety of locations:&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Singleton Pattern the right way</title><link>https://bryanavery.co.uk/singleton-pattern-the-right-way/</link><pubDate>Fri, 16 Aug 2013 10:04:00 +0000</pubDate><guid>https://bryanavery.co.uk/singleton-pattern-the-right-way/</guid><description>&lt;p&gt;The singleton pattern is used in almost all modern day programming languages, so why do I keep finding it written incorrectly in so many applications, so lets start with the right way&lt;/p&gt;&#10;&lt;pre class="brush: c-sharp;"&gt;public sealed class SimpleNoLockLazy&#10; {&#10; static readonly SimpleNoLockLazy instance = new SimpleNoLockLazy();&#10;&lt;pre&gt;&lt;code&gt; // Explicit static constructor to tell C# compiler&#10; // not to mark type as beforefieldinit&#10; static SimpleNoLockLazy()&#10; {&#10; }&#10;&#10; SimpleNoLockLazy()&#10; {&#10; }&#10;&#10; public static SimpleNoLockLazy Instance&#10; {&#10; get&#10; {&#10; return instance;&#10; }&#10; }&#10;}&amp;lt;/pre&amp;gt;&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;So why this implementation?   The reason for using a Singleton is for performance in a multi-threaded environment and this pattern is not only simple, but it is the fastest.  I have attached a benchmark application, which is based on &lt;a href="http://www.yoda.arachsys.com/csharp/SingletonBenchmark.cs" target="_blank"&gt;Jon Skeet’s benchmark&lt;/a&gt;, but testing using a Parallel processes.&lt;/p&gt;</description></item><item><title>Encrypting Web.config for the website</title><link>https://bryanavery.co.uk/encrypting-web-config-for-the-website/</link><pubDate>Thu, 17 Jan 2013 16:57:00 +0000</pubDate><guid>https://bryanavery.co.uk/encrypting-web-config-for-the-website/</guid><description>&lt;p&gt;Security is always high for installation to customer so is it not about time you encripted the connection string in your web.config file?&lt;/p&gt;&#10;&lt;p&gt;This is how it looks like before encrypting:&lt;/p&gt;&#10;&lt;pre class="brush: xml;"&gt;&amp;lt;connectionStrings&amp;gt;&#10; &amp;lt;add name="Pubs" connectionString="Server=localhost;Integrated Security=True;Database=Pubs"&#10; providerName="System.Data.SqlClient" /&amp;gt;&#10; &amp;lt;add name="Northwind" connectionString="Server=localhost;Integrated Security=True;Database=Northwind"&#10; providerName="System.Data.SqlClient" /&amp;gt;&#10;&amp;lt;/connectionStrings&amp;gt;&lt;/pre&gt;&#10;&lt;p&gt;We can encrypt any section of your Web.config file on-the-fly and programatically. If you have full access to your Web server, you can encrypt your connection strings with this single command-line located in the in the %windows%\Microsoft.NET\Framework\versionNumber folder:&lt;/p&gt;</description></item><item><title>Don’t and Do’s in C#</title><link>https://bryanavery.co.uk/dont-and-dos-in-c/</link><pubDate>Thu, 17 Jan 2013 03:36:00 +0000</pubDate><guid>https://bryanavery.co.uk/dont-and-dos-in-c/</guid><description>&lt;p&gt;For a while now I have been reviewing developers code and performing &lt;a href="https://bryanavery.co.uk/post/2013/01/17/Code-Review-Guidelines/" target="_blank"&gt;code reviews&lt;/a&gt; and I have noticed some common mistakes are being repeated time and time again. These are mostly the mistakes, which once you point them, are quite easy to remember. However, if a developer is not aware of them, they can cause many problems with the efficiency and quality of the developed software. So what are these common mistakes and why are they wrong?&lt;/p&gt;</description></item><item><title>Visual C# and .NET 4.0 samples</title><link>https://bryanavery.co.uk/visual-c-and-net-4-0-samples/</link><pubDate>Tue, 14 Feb 2012 09:46:00 +0000</pubDate><guid>https://bryanavery.co.uk/visual-c-and-net-4-0-samples/</guid><description>&lt;p&gt;I came across some nice C# samples from Microsoft today providing everything from Hello World, to how to use Yield and how to program Attributes.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://bryanavery.co.uk/file.axd?file=2012/2/OfficialVisualStudio2010SamplesforCsharp40.zip"&gt;Official Visual Studio 2010 Samples for C# 4.0&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Worth having a look at if you are a beginner or a seasoned programmer.&lt;/p&gt;</description></item><item><title>Workflow with TFS</title><link>https://bryanavery.co.uk/workflow-with-tfs/</link><pubDate>Tue, 17 Jan 2012 15:35:00 +0000</pubDate><guid>https://bryanavery.co.uk/workflow-with-tfs/</guid><description>&lt;p&gt;I’ve been working with TFS for sometime and when you are using the process flows you need to understand how the workflows work with the work items types.&lt;/p&gt;&#10;&lt;p&gt;There are two main types I have worked with Agile and CMMI Process Improvements.&lt;/p&gt;</description></item><item><title>Lifestyles of the Castle Windsor IoC Containers</title><link>https://bryanavery.co.uk/lifestyles-of-the-castle-windsor-ioc-containers/</link><pubDate>Thu, 01 Apr 2010 14:12:00 +0000</pubDate><guid>https://bryanavery.co.uk/lifestyles-of-the-castle-windsor-ioc-containers/</guid><description>&lt;p&gt;It’s worth knowing how the Castle Windsor IoC work, by default it uses Singletons, where this will work for the most of the time, there are a lot more options available to you depending on your needs.  These lifestyles that are available in Castle Windsor are:&lt;/p&gt;</description></item><item><title>Introduction to Dependency Injection</title><link>https://bryanavery.co.uk/introduction-to-dependency-injection/</link><pubDate>Thu, 01 Apr 2010 09:00:00 +0000</pubDate><guid>https://bryanavery.co.uk/introduction-to-dependency-injection/</guid><description>&lt;p&gt;Dependency Injection (DI) is an incredibly useful and easy technique which makes your code a lot easier to test.&lt;/p&gt;&#10;&lt;p&gt;I like to use samples to explain Dependency Injection. We’ll use a SqlMetaDataProvider class which needs to provide the meta data coming from a SQL Server database. It retrieves the meta data from the database in a relational structure (a DataSet) and then converts it to an easy to use object model. Obviously, i want to be able to test this class without actually going to the database because that would make the tests slow. So how can we test if the relational data is being converted to the object model without going to the database?&lt;/p&gt;</description></item><item><title>StructureMap Example</title><link>https://bryanavery.co.uk/structuremap-example/</link><pubDate>Thu, 22 Jan 2009 11:47:00 +0000</pubDate><guid>https://bryanavery.co.uk/structuremap-example/</guid><description>&lt;p&gt;After using StructureMap for a while I thought it would be nice to generate a simple example of how it all works, so I’ve built in Visual Studio 2008, both C# and a VB.NET version.&lt;/p&gt;</description></item><item><title>App.Config Custom Configuration</title><link>https://bryanavery.co.uk/app-config-custom-configuration/</link><pubDate>Fri, 31 Oct 2008 09:46:00 +0000</pubDate><guid>https://bryanavery.co.uk/app-config-custom-configuration/</guid><description>&lt;p&gt;I wrote this small POC, with a little help from samples around the Internet, to retrieve a custom configuration from the application config file (such as web.config)&lt;/p&gt;&#10;&lt;p&gt;It uses the Microsoft classes &lt;a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection/" rel="noopener noreferrer" target="_blank"&gt;ConfigurationSection&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationelementcollection/" rel="noopener noreferrer" target="_blank"&gt;ConfigurationElementCollection,&lt;/a&gt;  and &lt;a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationelement/" rel="noopener noreferrer" target="_blank"&gt;ConfigurationElement&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>