Visual Studio recently introduced a new feature called port tunneling. By using port tunneling, Visual Studio will create a new public URL (tunnel URL) for you, and HTTP requests sent to the tunnel URL will be forwarded to your ASP.NET Core project running on localhost.
Port tunneling has a lot of use cases. You could use this to easily test your web application on other devices like mobiles phone and tablets. You could also use this to make your application temporarily, publicly available for doing interactive demos and inviting your audience to participate.
How to use port tunneling with Twilio
The most exciting use case for Twilio is that you can use port tunneling to test webhooks. What are webhooks again?
"Webhooks are user-defined HTTP callbacks. They are triggered by some event in a web application and can facilitate integrating different applications or third-party APIs, like Twilio." …
Sometimes you need to send out emails at a certain interval - monthly, weekly, daily, or even more frequent. To run jobs on a time interval, you can use operating system tools like cron jobs on Linux or the task scheduler on Windows. Alternatively, you can create your own long running application that schedules the jobs for you. However, developing a robust job scheduler is not an easy task. Luckily, there are some great libraries that take care of this for you like Hangfire.
Check out this article to learn how to send recurring emails using Quartz.NET, which is another scheduling system for .NET.
You will need a few things to follow along:
- A Twilio SendGrid Account. Sign up here to send up to 100 emails per day …
Sending out newsletters is a great way to keep your audience up-to-date on the latest news. There are existing newsletter products like SendGrid Email Marketing, however, in a scenario where the client demands more customization, building a newsletter app yourself using the SendGrid Email API is a great alternative.
The advantage of building your own newsletter application is that you can control the nuts and bolts of the system and still maximize deliverability and measure engagement with SendGrid.
In this tutorial, you will learn how to build a newsletter app using ASP.NET Core Razor Pages and SendGrid.
Every newsletter application involves two parties: the subscriber of the newsletter, and the author of the newsletter.
The subscriber's journey goes like this: The soon-to-be subscriber fills out a form to subscribe that includes their email address and other details (depending on your business needs). When the subscriber submits the …
In this post, you will learn the basics of testing ASP.NET Core Minimal APIs. You’ll get started with testing a “hello world” endpoint, and then test a more complex API that returns JSON data. You’ll finish with customizing the ASP.NET Core service collection, so you can customize services for your unit tests and integration tests.
By the end of this post, you will have a good understanding of how to make sure your ASP.NET Core Minimal APIs behave as expected and can be deployed to production, even on Fridays!
There are a hundred different ways to provide configuration to your applications. For almost any programming language, you can use environment variables and .env files, but configuration can also be stored in other file formats like JSON, YAML, TOML, XML, INI, and the list keeps on going. Though, in some scenarios configuration isn't pulled from files, but instead is pulled from a service like Azure Key Vault, HashiCorp Vault, or a similar vault service. It is rare that your configuration will come from a single source. Luckily, there are APIs in .NET that can help you grab configuration from multiple sources and merge them together.
In this tutorial, you'll start with an application that sends text messages using Twilio Programmable SMS, where the configuration is fetched directly from the environment variables. You'll then refactor the app to
- fetch configuration from multiple sources, specifically, JSON files, user-secrets, environment variables, and …
The Twilio helper library for ASP.NET (Twilio.AspNet) is a community-driven open-source project to make integrating Twilio with ASP.NET easier, for both ASP.NET Core and ASP.NET MVC on .NET Framework. The library helps you with very common use cases like:
- Responding to Twilio webhook requests with TwiML objects from the official Twilio SDK for C# and .NET.
- Binding data from Twilio webhook requests to strongly typed .NET objects.
- Validating webhook requests originate from Twilio and rejecting them if not.
As .NET and ASP.NET is evolving, the Twilio.AspNet contributors are enhancing the library to take advantage of the newest capabilities and best practices. So what's new?
What's old in Twilio.AspNet
Actually, before I share the shiny new additions, let me share what is already part of the library. After all, this is the first blog post to share news about the library.
Handle Twilio webhook requests with ASP.NET
In previous versions …
At times, people in many organizations must organize and associate files (such as accounts, invoices, and more) with each employee or vendor in the company. Generally, these files arrive by email to a default mailbox that is constantly monitored, but manually. In this post, you are going to learn how to organize and associate files that users send by email to a particular mailbox through Twilio SendGrid with an API built in ASP.NET.
To complete this tutorial, you will need a free Twilio SendGrid account and experience working with ASP.NET applications using the C# language. Sign up here to send up to 100 emails per day completely free of charge.
Additionally, the API that you are going to create needs to be publicly exposed to be accessed from Twilio SendGrid, in this tutorial you will use ngrok to test your application without the need to deploy it in …
Every few years, the Open Web Application Security Project (OWASP) publishes a new list of the 10 most common security issues in web applications, called OWASP Top 10. There is one security flaw that has been around since the first edition in 2003, and grabbed the first spot in the 2010, 2013, and 2017 editions, and that security issue is vulnerability to injection attacks. I previously talked about injection attacks in general and more specifically, how dangerous email HTML injection attacks are and how you can prevent them. However, in this post, you'll learn how you can mitigate HTML injection attacks in .NET specifically.
How HTML injection into emails work
HTML injection is a vulnerability where an application accepts user input and then embeds the input into HTML. A malicious user can inject HTML through the user input so that their malicious HTML is embedded into …
As part of ASP.NET Identity, ASP.NET Core provides a bunch of features for account management, authentication, and authorization. ASP.NET Identity also sends emails to confirm email addresses and reset passwords, but it's up to you to implement how those emails are sent.
In this tutorial, you will learn how to send ASP.NET Identity emails using Twilio SendGrid.
You will need these things to follow along:
- An OS that supports .NET (Windows/macOS/Linux)
- .NET 6 SDK
- A code editor or IDE (I recommend VS Code with the C# plugin, Visual Studio, or JetBrains Rider)
- A Twilio SendGrid account. Sign up here to send up to 100 emails per day completely free of charge.
Configure your SendGrid account …