Blog - ASP.NET

Swimburger

How to build a URL Shortener with C# .NET and Redis

- .NET
Learn how to build a link shortener using C#, .NET, and Redis. You'll be using ASP.NET Core to build the URL forwarder and the System.CommandLine libraries to manage the data.

Use XML Literals in Visual Basic .NET to generate TwiML

- .NET
Learn how to generate TwiML instructions to respond to texts and voice calls using XML Literals in Visual Basic .NET and ASP.NET Core Minimal APIs.
Use Raw String Literals to generate TwiML in C# 11

Use Raw String Literals to generate TwiML in C# 11

- .NET
Learn how Twilio uses webhooks and TwiML to give you control over how to respond to a call or text message. You can generate TwiML in many ways, and with C# 11 you can now also use Raw String Literals.

Use Visual Studio dev tunnels to handle Twilio Webhooks

- .NET
Learn how to develop webhooks on your local machine using Visual Studio dev tunnels and ASP.NET Core.
Conversation between an iPhone user and the SMS bot. The user says "Hi" and the bot responds with "Welcome to the U.S. Representative lookup bot. Respond with your address. The user sends an address and the bot responds with "Your representative is Gerald E. Connolly (Democratic Party) representing Virginia"s 11th congressional district. Then the bot sends an image of the representative.

Find your US Representatives and Congressional Districts with SMS and ASP.NET Core

- .NET
Learn how to create an SMS bot that looks up U.S. Congressional Districts and Representatives using the Google Civic Information API, C#, ASP.NET Core Minimal API, and Twilio SMS.
.NET Bot holding a browser URL bar and a toolbox

How to get the full public URL of ASP.NET Core

- .NET
Learn how to get the public full URL of your ASP.NET Core application
.NET Bot holding a browser URL bar and a toolbox

How to generate absolute URLs in ASP.NET Core

- .NET
Learn how to generate full absolute URLs in C# and ASP.NET Core web applications.
.NET Bot holding a phone and bag with the Twilio logo

What's new in the Twilio helper library for ASP.NET (v5.73.0 - April 2022)

- .NET
Learn about what's new and old with the Twilio helper library for ASP.NET in version 5.73.0
How to prevent Email HTML injection in C# and .NET

How to prevent email HTML injection in C# and .NET

- .NET
Learn how bad actors can inject HTML into your emails in your C# .NET applications and how to mitigate it.
Twilio SendGrid logo

How to send ASP.NET Core Identity emails with Twilio SendGrid

- .NET
Learn how to use SendGrid to send account verification and password recovery emails in ASP.NET Core
ngrok logo

Integrate ngrok into ASP.NET Core startup and automatically update your webhook URLs

- .NET
Learn to integrate ngrok into ASP.NET Core's startup process to create secure public tunnels and automatically handle Twilio's webhooks with a single command
Umbraco logo

Integrate IndexNow with Umbraco CMS to submit content to search engines

- Umbraco
Umbraco is very extensible for ASP.NET developers. Learn how to integrate IndexNow into the Umbraco backoffice, so you can easily submit Umbraco content URLs to search engines that they will (re)crawl.
.NET Bot

How to get ASP.NET Core's local server URLs

- .NET
Learn how to access the ASP.NET Core's local server URLs in Program.cs, in controllers using Dependency Injection, and in IHostedService or BackgroundService.
Umbraco logo and Docker logo

How to run Umbraco 9 as a Linux Docker container

- Umbraco
Umbraco 9 has been built on top of .NET 5. As a result, you can now containerize your Umbraco 9 websites in Linux containers. Learn how to containerize Umbraco 9 with Docker.
Umbraco, Azure, and Linux logo

Deploying Umbraco 9 to Azure App Service for Linux

- Umbraco
Learn how to create the Azure infrastructure using the Azure CLI to host an Umbraco 9 website using Azure SQL and Azure App Service for Linux, and how to deploy your Umbraco 9 site.
Twilio logo

Handle No-Answer Scenarios with Voicemail and Callback

- .NET
With Twilio Programmable Voice you can ask customers to leave a message and their phone number if there's nobody available to take the call so you can give them a callback later
.NET Bot on a scooter riding from Umbraco 8 to 9

Thoughts and tips on moving to Umbraco 9 from Umbraco 8

- Umbraco
.NET Core was a groundbreaking change to the .NET platform. It is blazing fast, open-source, and cross-platform across Windows, Linux, and macOS. With Umbraco 9, we finally get to enjoy all the new innovations from .NET Core. Read about my experience upgrading an Umbraco 8 website to Umbraco 9.
Blazor logo

Get Your Head Together With Blazor’s New HeadContent and PageTitle

- .NET
Let’s take a look at the three Blazor components .NET 6 is introducing to help you manage the head of your document—PageTitle, HeadContent, and HeadOutlet.
Picture of Niels—white male with long blond hair— with a shocked expression

Guest on .NET Docs Show: Making Phone Calls 📞 from Blazor WebAssembly with Twilio Voice

- .NET
Earlier this week, the folks at the .NET Docs Show invited me over to talk about Twilio, .NET, and Blazor WebAssembly. We discussed different architectures, workflow diagrams, Twilio capabilities, and how to integrate them using ASP.NET WebAPI's and Blazor WebAssembly.
.NET Bot surfing a wave

How to bypass Captchas in Selenium UI tests

- .NET
Captchas are often used as a way to combat spam on website forms. Unfortunately, this also makes it harder to verify the functionality of the forms using UI tests like Selenium. To work around this you can extend your website with a bypass form.
.NET Bot holding a letter

Capture emails during development using smtp4dev and UI Test with Selenium

- .NET
You can use smtp4dev during development to prevent emails from going out to real customers. This tool also supports IMAP which you can use to query emails for automated testing.
.NET Bot holding a package with "ZIP" on it.

Create ZIP files on HTTP request without intermediate files using ASP.NET MVC Framework

- .NET
The ZipArchive wraps any stream to read, create, and update ZIP archives. You can send the result to the client using ASP.NET MVC Framework.
Blazor logo pointing to the GitHub logo pointing to the DigitalOcean logo

How to deploy Blazor WebAssembly to DigitalOcean App Platform

- .NET
Blazor WebAssembly can be served as static files. These files can be hosted in static hosting services such as DigitalOcean App Platform.
.NET Bot dressed up as a doctor

Don't use HttpContext.Current, especially when using async

- .NET
Avoid using HttpContext.Current if possible, especially in asynchronous code. Use the properties provided on the Page or Controller instead and pass them on to the asynchronous code.
.NET Bot holding a package with "ZIP" on it.

Create ZIP files on HTTP request without intermediate files using ASP.NET Core MVC, Razor Pages, and endpoints

- .NET
The ZipArchive wraps any stream to read, create, and update ZIP archives. You can send the result to the client using ASP.NET MVC, Razor Pages, and endpoints.
Blazor logo pointing to the GitHub logo pointing to the Cloudflare Pages logo

How to deploy Blazor WebAssembly to Cloudflare Pages

- .NET
Blazor WebAssembly can be served as static files. These files can be hosted in static hosting services such as Cloudflare Pages.
Heroku and Blazor logo

How to deploy Blazor WebAssembly to Heroku

- .NET
Heroku doesn't officially offer a static hosting service but does have an experimental 'buildpack' which gives you static hosting capabilities you can use to deploy and host Blazor WebAssembly.
Blazor logo pointing to the GitHub logo pointing to the AWS Amplify logo.

How to deploy Blazor WebAssembly to AWS Amplify

- .NET
Blazor WebAssembly can be served as static files. These files can be hosted in static hosting services such as AWS Amplify.
.NET Bot building an application

Use project Tye to host Blazor WASM and ASP.NET Web API on a single origin to avoid CORS

- .NET
Using Microsoft's experimental Project Tye, you configured the proxy to forward requests to '/api' to the Web API, and all other requests to the Blazor WASM client.
Blazor logo pointing to the GitHub logo and the GitHub logo pointing to the Netlify logo.

How to deploy Blazor WebAssembly to Netlify

- .NET
Now that you can run .NET web applications without server-side code, you can deploy these applications to various static site hosts, such as Netlify.
.NET Bot building an application

Use YARP to host client and API server on a single origin to avoid CORS

- .NET
Using Microsoft's new reverse proxy "YARP", you configured the proxy to forward requests to '/api' to the Web API, and all other requests to the Blazor WASM client.
 Blazor logo next to an arrow pointing to the GitHub logo next to a double arrow pointing from the GitHub logo to the Firebase Hosting logo

Video: How to deploy Blazor WebAssembly to Firebase Hosting

- .NET
With ASP.NET Blazor WebAssembly you can create .NET applications that run completely inside of the browser. The output of a Blazor WASM project are all static files. You can deploy these applications to various static site hosts like Firebase Hosting.
Blazor logo

Pre-render Blazor WebAssembly at build time to optimize for search engines

- .NET
Using pre-rendering tools like react-snap, you can pre-render Blazor WASM. Additionally, you can integrate these pre-rendering tools inside of your continuous integration and continuous deployment pipelines.
Blazor logo

Fix Blazor WebAssembly PWA integrity checks

- .NET
The service-worker-assets.js file is generated during publish and any modification made to the listed files after publish will cause the integrity check to fail.
 Blazor logo next to an arrow pointing to the GitHub logo next to a double arrow pointing from the GitHub logo to the Firebase Hosting logo

How to deploy Blazor WebAssembly to Firebase Hosting

- .NET
With ASP.NET Blazor WebAssembly you can create .NET applications that run completely inside of the browser. The output of a Blazor WASM project are all static files. You can deploy these applications to various static site hosts like Firebase Hosting.
Blazor and GitHub logo

Video: How to deploy ASP.NET Blazor WebAssembly to GitHub Pages

- .NET
With ASP.NET Blazor WebAssembly you can create .NET applications that run completely inside of the browser. The output of a Blazor WASM project are all static files. You can deploy these applications to various static site hosts like GitHub Pages.
Blazor next to JavaScript logo

Interacting with JavaScript Objects using the new IJSObjectReference in Blazor

- .NET
A new type is introduced in .NET 5 called IJSObjectReference. This type holds a reference to a JavaScript object and can be used to invoke functions available on that JavaScript object.
.NET Bot

Harden Anti-Forgery Tokens with IAntiforgeryAdditionalDataProvider in ASP.NET Core

- .NET
Using IAntiforgeryAdditionalDataProvider you can harden ASP.NET Core's anti-forgery token feature by adding additional data and validating the additional data.
Blazor and Twilio logo

Making Phone Calls from Blazor WebAssembly with Twilio Voice

- .NET
Using Twilio Voice you can add the ability to make and receive phone calls from your own ASP.NET web applications. Twilio’s helper library for JavaScript makes it easy to integrate client functionality into web front ends built with Blazor WebAssembly, and the Twilio NuGet packages provide you with convenient interfaces to Twilio’s APIs for server-side tasks.
Blazor logo next to JavaScript logo

Communicating between .NET and JavaScript in Blazor with in-browser samples

- .NET
The success of Blazor relies heavily upon how well it can integrate with the existing rich JavaScript ecosystem. The way Blazor allows you to integrate, is by enabling you to call JavaScript functions from Blazor and .NET functions from JavaScript also referred to as 'JavaScript interoperability'.
.NET Bot writing on a whiteboard

Configure CORS using AppSettings or Custom Configuration Sections in ASP.NET Web API

- .NET
Microsoft's CORS library works, but the attributes force you to hardcode the CORS headers. By creating custom CORS attributes, you can read the CORS configuration from AppSettings or a custom config section.
Blazor and Firebase logo

Real-time applications with Blazor Server and Firestore

- DotNet
Blazor Server is built on SignalR, which is built on websockets. Among things, websockets enable Blazor Server to push changes from the server to the browser at any time. You can build real-time UI's when you combine this with a real-time database.
Blazor logo

Pushing UI changes from Blazor Server to browser on server raised events

- .NET
Blazor Server is built on SignalR, and SignalR is built on websockets among other techniques. The combination of these technologies allow Blazor Server to push UI changes into the client without the client requesting those changes.
Umbraco logo

Introducing Umbraco's KeepAlive Ping configuration

- Umbraco
Umbraco 8.6 introduces the new keepAlive configuration inside of `umbracoSettings.config` which allows you to change "keepAlivePingUrl" and "disableKeepAliveTask"
Azure Application Insights logo

Capturing ASP.NET Framework RawUrl with Azure Application Insights

- Azure
By default, Application Insights will capture a lot of data about your ASP.NET applications including HTTP Requests made to your website. Unfortunately, the URL captured by Application Insights doesn't always match the URL originally requested by the client.
Azure Application Insights logo

Capturing ASP.NET Core original URL with Azure Application Insights

- Azure
By default, Application Insights will capture a lot of data about your ASP.NET applications including HTTP Requests made to your website. Unfortunately, the URL captured by Application Insights doesn't always match the URL originally requested by the client.
Blazor and GitHub logo

How to deploy ASP.NET Blazor WebAssembly to GitHub Pages

- .NET
With ASP.NET Blazor WebAssembly you can create .NET applications that run completely inside of the browser. The output of a Blazor WASM project are all static files. You can deploy these applications to various static site hosts like GitHub Pages.
How to deploy ASP.NET Blazor WebAssembly to Azure Static Web Apps. Blazor logo pointing to a GitHub logo pointing to an Azure logo.

How to deploy Blazor WASM & Azure Functions to Azure Static Web Apps using GitHub

- .NET
With ASP.NET Blazor WebAssembly you can create .NET applications that run inside of the browser . The output of a Blazor WASM project are all static files. You can deploy these applications to static site hosts, such as Azure Static Web Apps and GitHub Pages.
ASP.NET Blazor Logo

How to run code after Blazor component has rendered

- .NET
Blazor components render their template whenever state has changed and sometimes you need to invoke some code after rendering has completed. This blog post will show you how to run code after your Blazor component has rendered, on every render or as needed.
DNN Logo

How to add Hangfire to DNN

- .NET
DNN already has an excellent built-in scheduler you can use to schedule tasks. But you may be more familiar with and prefer Hangfire for running background jobs. These instruction will walk you through configuring Hangfire in with DNN.
Screenshot of NCrontab Expression Tester tool

Introducing NCrontab Tester (Blazor WebAssembly)

- .NET
Introducing NCrontab Expression tester, made using NCrontab .NET library, Blazor WebAssembly, and hosted on Azure Static Web Apps
.NET

Download .NET Windows Theme based on the new .NET Brand GitHub repo

- .NET
The .NET GitHub org has a new Brand repository containing a detailed Brand guidelines PDF, logo's, illustrations, and wallpapers. Using these resources I put together a Windows Theme for .NET which you can download here!
.NET Core logo + Dotnet bot wearing Red Hat

How to run ASP.NET Core Web Application as a service on Linux without reverse proxy, no NGINX or Apache

- .NET
This article walks us through running a ASP.NET Core web application on Linux (RHEL) using systemd. The end goal is to serve ASP.NET Core directly via the built-in Kestrel webserver over port 80/443.
Phone/Tablet/Laptop displaying Umbraco logo

Implementing Responsive Images in Umbraco

- Umbraco
The web platform has responsive image capabilities such as the srcset-attribute, sizes-attribute, and the picture-element. These capabilities may seem daunting sometimes. We'll learn how to make them available and maintainable to Umbraco content editors.
Screenshot of the HTML Agility Pack homepage

Auto generate Heading Anchors using HTML AgilityPack DOM Manipulation

- .NET
Manually adding an anchor to every heading would be a painful solution. So let's learn how we can achieve this by generating the Heading Anchors using the HTML AgilityPack .NET library.
Robot with Umbraco logo

Crawling through Umbraco with Robots

- Umbraco
The robots.txt file’s main purpose is to tell robots (Google Bot, Bing Bot, etc.) what to index for their search engine, and also what not to. Usually you want most of your website crawled by Google, such as blog posts, product pages, etc., but most websites will have some pages/sections that shouldn’t be indexed or listed in search engines.
Azure Application Insights logo + Umbraco logo

Ignoring Umbraco ping.aspx from Azure Application Insights

- Umbraco
Application Performance Monitors provide you with a lot of data, but some of that data may not be relevant. Specifically, in Umbraco there is a page at \umbraco\ping.aspx that is being called frequently to keep the site alive. This is very useful to prevent the site from "dying" (?), but the data for this request isn't that relevant and could skew your statistics. Using Azure Application Insights ITelemetryProcessor, we can prevent ping request from being sent to Azure Application Insights.
Spider Web with Umbraco logo

Crawling through Umbraco with Sitemaps

- Umbraco
Websites come in all shapes and sizes. Some are fast, some are beautiful, and some are a complete mess. Whether it's a high-quality site is irrelevant if people can’t find it, but search engines are here to help. Though the competition to get on first page is tough, this series will dive into some common practices to make your website crawlable.