﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom">
  <channel>
    <title>Newest KB Articles in Sample code</title>
    <description>Recent additions to the knowledge base from DiscountASP.NET</description>
    <link>https://support.discountasp.net/kb/c351/sample-code.aspx</link>
    <pubDate>Wed, 10 Jun 2026 04:37:05 GMT</pubDate>
    <generator>SmarterTrack Enterprise 100.0.9553</generator>
    <atom:link href="https://support.discountasp.net/RSS.ashx?catid=351&amp;type=newestkbarticles" rel="self" type="application/rss+xml" />
    <item>
      <title>How to send email in ASP.NET with SMTP authentication</title>
      <link>https://support.discountasp.net/kb/a1060/how-to-send-email-in-asp_net-with-smtp-authentication.aspx</link>
      <pubDate>Tue, 10 Jul 2012 19:58:57 GMT</pubDate>
      <guid isPermaLink="false">kbarticle1060</guid>
      <description>&lt;div&gt;Basic examples of sending mail using System.Net.Mail in C# and VB.NET. &amp;nbsp;Settings that require updating highlighted in red.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;strong style="box-sizing: border-box; font-weight: bolder;"&gt;Trust Level and TLS Requirements&lt;/strong&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;The scripting will require that the Trust Level is set to Full in a site&amp;#39;s web.config, syntax example&lt;/div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;configuration&amp;gt;
  &amp;lt;system.web&amp;gt;
    &amp;lt;trust level=&amp;quot;Full&amp;quot;/&amp;gt;
  &amp;lt;/system.web&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;TLS 1.2 is also required in order to make an encrypted connection to the mail server. &amp;nbsp;If TLS 1.2 is not already forced for a site / application, bootstrapping code needs to be added to the mail scripting with syntax differing slightly between C# and VB.NET. &amp;nbsp;Highlighted in red in the below scripting examples.&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;strong style="box-sizing: border-box; font-weight: bolder;"&gt;C#&lt;/strong&gt;&lt;/div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;&lt;/pre&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;strong style="box-sizing: border-box; font-weight: bolder;"&gt;VB.NET&lt;/strong&gt;&lt;/div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, System.Net.SecurityProtocolType)&lt;/pre&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;strong style="box-sizing: border-box; font-weight: bolder;"&gt;C# Example&lt;/strong&gt;&lt;/div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&amp;lt;%@ Import Namespace=&amp;quot;System.Net&amp;quot; %&amp;gt;
&amp;lt;%@ Import Namespace=&amp;quot;System.Net.Mail&amp;quot; %&amp;gt;

&amp;lt;script language=&amp;quot;C#&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
  protected void Page_Load(object sender, EventArgs e)
  {
    &lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;&lt;/span&gt;
    MailMessage mail = new MailMessage();

    mail.From = new MailAddress(&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;);
    mail.To.Add(&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;);

    mail.Subject = &amp;quot;Test email sent from System.Net.Mail&amp;quot;;
    mail.Body = &amp;quot;Mail test&amp;quot;;
    mail.Headers.Add(&amp;quot;Message-Id&amp;quot;,
                      String.Format(&amp;quot;&amp;lt;{0}@{1}&amp;gt;&amp;quot;,
                      Guid.NewGuid().ToString(),
                      &amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;domain.com&lt;/span&gt;&amp;quot;));

    SmtpClient smtp = new SmtpClient(&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;sm##.internetmailserver.net&lt;/span&gt;&amp;quot;);

    NetworkCredential Credentials = new NetworkCredential(&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;, &amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;p&lt;/span&gt;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;assword&lt;/span&gt;&amp;quot;);
    smtp.Credentials = Credentials;
    smtp.EnableSsl = true;
    smtp.Port = 25;
    smtp.Send(mail);
    lblMessage.Text = &amp;quot;Mail Sent&amp;quot;;
  }
&amp;lt;/script&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;form runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;asp:Label id=&amp;quot;lblMessage&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;
  &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;br style="box-sizing: border-box;"&gt;&lt;/div&gt;&lt;div style='box-sizing: border-box; color: rgb(51, 51, 51); font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&lt;strong style="box-sizing: border-box; font-weight: bolder;"&gt;VB.NET Example&lt;/strong&gt;&lt;/div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&amp;lt;%@ Page Language=&amp;quot;VB&amp;quot; %&amp;gt;
&amp;lt;%@ Import Namespace=&amp;quot;System.Net.Mail&amp;quot; %&amp;gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;
  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    &lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, System.Net.SecurityProtocolType)&lt;/span&gt;
    Dim strFrom = &amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;
    Dim strTo = &amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;
    Dim Mail As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
    Mail.BodyEncoding = Encoding.Default
    Mail.Subject = &amp;quot;Test email sent from System.Net.Mail&amp;quot;
    Mail.Body = &amp;quot;Mail test&amp;quot;
    Mail.Headers.Add(&amp;quot;Message-Id&amp;quot;,
                      String.Format(&amp;quot;&amp;lt;{0}@{1}&amp;gt;&amp;quot;,
                      Guid.NewGuid().ToString(),
                      &amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;domain.com&lt;/span&gt;&amp;quot;))
    Mail.Priority = MailPriority.High
    Mail.IsBodyHtml = True

    Dim SmtpMail As New SmtpClient
    Dim basicAuthenticationInfo As New System.Net.NetworkCredential(&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;, &amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;p&lt;/span&gt;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;assword&lt;/span&gt;&amp;quot;)

    SmtpMail.Host = &amp;quot;s&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;m##.internetmailserver.net&lt;/span&gt;&amp;quot;
    SmtpMail.UseDefaultCredentials = False
    SmtpMail.Credentials = basicAuthenticationInfo
    SmtpMail.EnableSsl = true
    SmtpMail.Port = 25

    SmtpMail.Send(Mail)
    lblMessage.Text = &amp;quot;Mail Sent&amp;quot;
  End Sub
&amp;lt;/script&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;form runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;asp:Label id=&amp;quot;lblMessage&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;
  &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>How to send mail using CDO - SMTP authentication</title>
      <link>https://support.discountasp.net/kb/a1057/how-to-send-mail-using-cdo-smtp-authentication.aspx</link>
      <pubDate>Mon, 02 Jul 2012 14:36:41 GMT</pubDate>
      <guid isPermaLink="false">kbarticle1057</guid>
      <description>&lt;div&gt;&lt;span style="color: rgb(51, 51, 51); font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;Basic example of sending mail using CDO in Classic ASP. &amp;nbsp;Settings that require updating highlighted in red.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;pre class="prettyprint"&gt;&amp;lt;%
set objMessage = createobject(&amp;quot;cdo.message&amp;quot;)
set objConfig = createobject(&amp;quot;cdo.configuration&amp;quot;)
Set Flds = objConfig.Fields

Flds.Item(&amp;quot;http://schemas.microsoft.com/cdo/configuration/sendusing&amp;quot;) = 2
Flds.Item(&amp;quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&amp;quot;) =&amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;sm##.internetmailserver.net&lt;/span&gt;&amp;quot;

Flds.Item (&amp;quot;http://schemas.microsoft.com/cdo/configuration/smtpauthenticate&amp;quot;) = 1
Flds.Item (&amp;quot;http://schemas.microsoft.com/cdo/configuration/sendusername&amp;quot;) =&amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;
Flds.Item (&amp;quot;http://schemas.microsoft.com/cdo/configuration/sendpassword&amp;quot;) =&amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;password&lt;/span&gt;&amp;quot;

Flds.update
Set objMessage.Configuration = objConfig
objMessage.To = &amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;
objMessage.From = &amp;quot;&lt;span style="color: rgb(255, 0, 0);"&gt;postmaster@domain.com&lt;/span&gt;&amp;quot;
objMessage.Subject = &amp;quot;CDO email test&amp;quot;
objMessage.fields.update
objMessage.HTMLBody = &amp;quot;Test sent from CDO using smtp authentication.&amp;quot;
objMessage.Send
%&amp;gt;&lt;/pre&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Sample code to connect to an MS SQL database using php</title>
      <link>https://support.discountasp.net/kb/a755/sample-code-to-connect-to-an-ms-sql-database-using-php.aspx</link>
      <pubDate>Fri, 22 Jan 2010 01:21:45 GMT</pubDate>
      <guid isPermaLink="false">kbarticle755</guid>
      <description>&lt;div&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;The following is sample code to connect to a MS SQL database using the php MS SQL driver. &amp;nbsp;On lines two and three, server, dbName, userName and password should be replaced with the connection settings for the applicable database.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;Note that the driver works for SQL 2005 and higher, but not SQL 2000.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;pre style='box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.25px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: rgb(33, 37, 41); background-color: rgb(248, 248, 248); border: 1px solid rgb(221, 221, 221); padding: 10px; white-space: pre-wrap; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;'&gt;&amp;lt;?php
$serverName = &amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;serverName&lt;/span&gt;&amp;quot;;
$connectionInfo = array( &amp;quot;Database&amp;quot;=&amp;gt;&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;databaseName&lt;/span&gt;&amp;quot;, &amp;quot;UID&amp;quot;=&amp;gt;&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;userName&lt;/span&gt;&amp;quot;, &amp;quot;PWD&amp;quot;=&amp;gt;&amp;quot;&lt;span style="box-sizing: border-box; color: rgb(255, 0, 0);"&gt;password&lt;/span&gt;&amp;quot;, &amp;quot;TrustServerCertificate&amp;quot;=&amp;gt;True);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo &amp;quot;Connection established.&amp;lt;br /&amp;gt;&amp;quot;;
}else{
     echo &amp;quot;Connection could not be established.&amp;lt;br /&amp;gt;&amp;quot;;
     die( print_r( sqlsrv_errors(), true));
}
?&amp;gt;&lt;/pre&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;If you run into problems when using this code, please post in our &lt;a href="http://community.discountasp.net/"&gt;community forum&lt;/a&gt;. Technical support is unable to assist with specific coding issues.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>How to set up a connection string so communication with the SQL server is encrypted</title>
      <link>https://support.discountasp.net/kb/a753/how-to-set-up-a-connection-string-so-communication-with-the-sql-server-is-encrypted.aspx</link>
      <pubDate>Thu, 14 Jan 2010 00:19:29 GMT</pubDate>
      <guid isPermaLink="false">kbarticle753</guid>
      <description>&lt;p&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;The connection string below is an example that specifies the use of encryption.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;Essentially you are using the connection string from the SQL section of your control panel and adding&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;encrypt=true&lt;/strong&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;to the end. Setting the encrypt property to true will cause the transmission of data to and from the SQL server to be encrypted.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class="prettyprint"&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;&amp;lt;connectionStrings&amp;gt;

&amp;lt;add name=&amp;quot;MyConn&amp;quot; connectionString=&amp;quot;Data Source=server;Initial Catalog=database;User ID=username;Password=password; encrypt=true;TrustServerCertificate=true&amp;quot; providerName=&amp;quot;System.Data.SqlClient&amp;quot;/&amp;gt;

&amp;lt;/connectionStrings&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>How to query a SQL database with .NET SQL Data Provider in ASP.NET</title>
      <link>https://support.discountasp.net/kb/a373/how-to-query-a-sql-database-with-_net-sql-data-provider-in-asp_net.aspx</link>
      <pubDate>Tue, 25 Nov 2008 00:56:40 GMT</pubDate>
      <guid isPermaLink="false">kbarticle373</guid>
      <description>&lt;pre class="prettyprint"&gt;
&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;&amp;lt;%@ import namespace=&amp;quot;system.data.sqlclient&amp;quot; %&amp;gt;
&amp;lt;Script runat=&amp;quot;server&amp;quot;&amp;gt;
Sub page_load            
        Dim dbconn as sqlconnection            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;Dim dbCMD as sqlCommand            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;Dim dtr as sqldatareader            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dbConn = New SQLConnection (&amp;quot;Data Source=DBSERVERNAME;Initial Catalog=YOURDBNAME;User ID=YOURUSERID;Password=YOURPASSWORD&amp;quot;)            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dbConn.open()            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dbCMD = new sqlcommand (&amp;quot;select * from tblTest&amp;quot;,dbconn)            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dtr = dbCMD.executereader()            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;While dtr.read()                        
        &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;response.write (&amp;quot;&amp;lt;li&amp;gt;&amp;quot;)                        
        &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;response.write (dtr(0) &amp;amp; &amp;quot;---&amp;quot; &amp;amp; dtr(1))            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;End while            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dtr.close()            
    &lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;dbConn.close()
End Sub
&amp;lt;/Script&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;div&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;If you run into problems when using this code, please post in the &lt;a href="http://community.discountasp.net/"&gt;DiscountASP.NET&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;or &lt;a href="http://forum.everleap.com/"&gt;Everleap&lt;/a&gt; community forum. Technical support is unable to assist with specific coding issues.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>How to insert data into an MS SQL database with .NET SQL Data Provider in ASP.NET</title>
      <link>https://support.discountasp.net/kb/a372/how-to-insert-data-into-an-ms-sql-database-with-_net-sql-data-provider-in-asp_net.aspx</link>
      <pubDate>Tue, 25 Nov 2008 00:55:34 GMT</pubDate>
      <guid isPermaLink="false">kbarticle372</guid>
      <description>&lt;div&gt;
&lt;pre class="prettyprint"&gt;
&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;&amp;lt;%@ import namespace=&amp;quot;system.data.sqlclient&amp;quot; %&amp;gt;
&amp;lt;Script runat=&amp;quot;server&amp;quot;&amp;gt;
Sub page_load            
        Dim dbconn as sqlconnection            
        Dim dbCMD as sqlCommand            
        dbConn = New SQLConnection (&amp;quot;Data Source=DBSERVERNAME;Initial Catalog=YOURDBNAME;User ID=YOURUSERID;Password=YOURPASSWORD&amp;quot;)            
        dbConn.open()            
        dbCMD = new sqlcommand (&amp;quot;insert into tblTest values ('test')&amp;quot;,dbconn)            
        dbCMD.executenonquery()            
        dbConn.close()
End Sub
&amp;lt;/Script&amp;gt;
Record Inserted&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;div&gt;&lt;span style="font-size:16px;"&gt;&lt;span style="font-family: arial,helvetica,sans-serif;"&gt;If you run into problems when using this code, please post in the &lt;a href="http://community.discountasp.net/"&gt;DiscountASP.NET&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;or &lt;a href="http://forum.everleap.com/"&gt;Everleap&lt;/a&gt; community forum. Technical support is unable to assist with specific coding issues.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>