How to Implement 2-Step Verification in ASP.NET MVC
page 4 of 12
by Keyvan Nayyeri
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 67878/ 206

SMS Communication

First things first! Looking at the problem defined above, an ASP.NET developer would guess that the implementation doesn’t have a very complex structure as long as the text messaging part is handled, and that is right. One of the biggest requirements of 2-step verification is a secure and reliable service to send your text messages from. This can be achieved by several services, but these days Twilio has become the de facto standard for phone communication for programmers. A cloud-based reliable solution with high security and simplified API wouldn’t leave doubts for you to use it as the solution unless you’re living outside the United States and Canada and may need to use your local service.

After referencing the Twilio API on Nuget (or manually), you can implement a very simple class to send a text message from your Twilio number to a destination number (Listing 1).

Listing 1: Text message communication

using Twilio;
 
namespace AspNetPhoneVerificationSample.Components
{
    public static class Messenger
    {
        public static void SendTextMessage(string number, string message)
        {
            TwilioRestClient twilioClient = 
                new TwilioRestClient("acccountSid""authToken");
            twilioClient.SendSmsMessage("+12065696562", number, message);
        }
    }
}

View Entire Article

User Comments

Title: No source code?   
Name: Larry Q
Date: 2011-12-07 10:39:10 AM
Comment:
Hi everyone,

I enjoyed Keyvan's article very much, however the source code link doesn't work. Is it possible to get the source from another location? Many thanks for writing this article, before I forget.

-Larry






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-04 5:33:18 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search