ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Send email with a webform link through a WebService in ASP.Net using C# and VB.Net<p>Explain in detail and also share your code and let us know the problem.</p>https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/Thu, 22 Mar 2018 05:02:43 GMTSend email with a webform link through a WebService in ASP.Net using C# and VB.Net<p>&nbsp;</p> <pre class="brush: vb">Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Web.Script.Serialization Imports System.Web.Script.Services Imports System.Data.SqlClient &#39; To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. &#39; &lt;System.Web.Script.Services.ScriptService()&gt; _ &lt;System.Web.Services.WebService(Namespace:=&#34;http://tempuri.org/&#34;)&gt; _ &lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _ &lt;ToolboxItem(False)&gt; _ Public Class WebService1 Inherits System.Web.Services.WebService &lt;WebMethod()&gt; _ Public Function GPSData(Data As String) As String Dim Message As New ServiceResult Dim djs As New System.Web.Script.Serialization.JavaScriptSerializer Dim attData As clsAttendanceData attData = djs.Deserialize(Of clsAttendanceData)(Data) Dim constr As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings.Item(&#34;constr&#34;).ConnectionString) constr.Open() Dim RowsAffected As Integer = 0 Dim d As DateTime = DateTime.Now.ToString(&#34;dd MM yyyy HH:mm:ss tt&#34;) Using cmd1 As New SqlCommand(&#34;Select DeviceId from EmployeeTable where Staff_No = &#34; &amp; attData.EmpId, constr) Dim sdr = cmd1.ExecuteReader() If sdr.HasRows = True Then sdr.Close() Dim tempDeviceId = cmd1.ExecuteScalar If tempDeviceId = attData.DeviceId Then For Each dt As clsGpsData In attData.data If d &lt; dt.gpsDateTime Then &#39;constr.ConnectionString = System.Configuration.ConfigurationManager.AppSettings(&#34;constr&#34;) Using cmd As New SqlCommand(&#34;INSERT INTO EmployeeLocationDetails (StaffId, DeviceId, gpsDateTime, Latitude, Longitude, Battery) VALUES ( @StaffId, @DeviceId, @gpsDateTime, @Latitude, @Longitude, @Battery)&#34;) cmd.Parameters.AddWithValue(&#34;@StaffId&#34;, attData.EmpId) cmd.Parameters.AddWithValue(&#34;@DeviceId&#34;, attData.DeviceId) cmd.Parameters.AddWithValue(&#34;@gpsDateTime&#34;, dt.gpsDateTime) cmd.Parameters.AddWithValue(&#34;@Latitude&#34;, dt.lat) cmd.Parameters.AddWithValue(&#34;@Longitude&#34;, dt.lng) cmd.Parameters.AddWithValue(&#34;@Battery&#34;, dt.battery) cmd.Connection = constr cmd.ExecuteNonQuery() RowsAffected = RowsAffected + cmd.ExecuteNonQuery() End Using Else Message.Result = -3 Message.Reason = dt.gpsDateTime &amp; &#34; is not a valid DateTime&#34; Return djs.Serialize(Message) End If Next Message.Result = 0 Message.Reason = RowsAffected &amp; &#34; Records Inserted&#34; Return djs.Serialize(Message) Else Message.Result = -1 Message.Reason = attData.DeviceId &amp; &#34; !!!!Is not Register!!!!&#34; Return djs.Serialize(Message) End If Else Message.Result = -2 Message.Reason = attData.EmpId &amp; &#34; is not a valid Employee ID&#34; Return djs.Serialize(Message) End If constr.Close() End Using End Function End Class</pre> <p>I need to send an email when it satisfies below&nbsp;else condition my motive is to store device id which is not registered and notify to&nbsp;the manager that&nbsp;someone try&nbsp;to hit some data from so and so device id </p> <pre class="brush: vb"> Message.Result = -1 Message.Reason = attData.DeviceId &amp; &#34; !!!!Is not Register!!!!&#34; Return djs.Serialize(Message) End If</pre>https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/Thu, 22 Mar 2018 06:39:32 GMTSend email with a webform link through a WebService in ASP.Net using C# and VB.Net<p>Refer below article link for your reference and implement it as per your code logic just call the SendEmail Method in your else condition where you need to send Email with the device details.</p> <h1 class="header"><a title="Send HTML Page (File) as Email Body in ASP.Net using C# and VB.Net'a" href="https://www.aspsnippets.com/Articles/Send-HTML-Page-File-as-Email-Body-in-ASPNet-using-C-and-VBNet.aspx">Send HTML Page (File) as Email Body in ASP.Net using C# and VB.Net</a></h1>https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/https://www.aspforums.net:443/Threads/130338/Send-email-with-a-webform-link-through-a-WebService-in-ASPNet-using-C-and-VBNet/Thu, 29 Mar 2018 07:40:47 GMT