Add a Send SMS View
Create a new folder under Views called Sms. Within Sms, add a file called index.cshtml that contains the following code:
@model SmsModel
@using (Html.BeginForm("sms", "sms", FormMethod.Post))
{
<div class="form-vertical">
<h4>
Sms<h4>
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.To)
<div>
@Html.EditorFor(model => model.To, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.To, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.From)
<div>
@Html.EditorFor(model => model.From, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.From, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Text)
<div>
@Html.EditorFor(model => model.Text, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Text, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit">Send</button>
</div>
</div>
</div>
}
<h2>@ViewBag.MessageId<h2>
<h3>@ViewBag.Error</h3>
How to Receive SMS Delivery Receipts with ASP.NET Core MVC
Delivery receipts allow you to get information about when an SMS is delivered to a user's handset. This tutorial shows how you can receive these delivery receipt notifications in your ASP .NET application.
手順
1
Introduction to this tutorial2
Prerequisites3
Create the SMS Project File4
Add Vonage Dotnet SDK5
Create Send SMS Model6
Create a Send SMS View7
Set up Startup Route8
Add an SMS Controller9
Add Delivery Receipt Route to Controller10
Configure the ASP.NET App11
Run the .NET App12
Conclusion