IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Use CDONTS.DLL on Windows Server 2012 R2

With Microsoft ending the support on Windows 2003, many classic ASP applications that use cdonts.dll to send automatic emails (cdonts.newmail) still need to be migrated to the newer server (Windows Server 2012 R2). One way you can tell an application is using it is when you encounter the following error message on your browser.

CDONTS.NEWMAIL ActiveX error

CDONTS was already deprecated since Window 2000 and completely removed in Windows 2003. The ideal way to do it is to use the newer and more robust cdosys.dll. But in practicality, this will require a code re-write and many companies with legacy applications just don’t want to spend the time or money to do so. So you just to move all the codes and make them work the same way on Windows Server 2012 R2 which is 64-bit only.

Here are the steps to make cdonts.dll work on the current Windows Server 2012 R2. Please note, that the DLL itself is no longer available on the server as it is replaced with cdosys.dll. You also need to install an internal SMTP server first prior to performing these steps below or else you won’t be able to configure the permission on the mail pickup directory (Step 4).

Steps

  1. Copy CDONTS.DLL from the old server Windows Server 2003 (C:\WINNT\system32).

    CDONTS.DLL on Windows Server 2003

  2. Paste the DLL to the Windows Server 2012 R2 (C:\Windows\SysWOW64).

    CDONTS.DLL copied to Windows Server 2012 R2

  3. Launch Command Prompt (Admin) and type regsvr32 C:\Windows\SysWOW64\cdonts.dll

    Register cdonts.dll on Windows Server 2012 R2's command prompt

  4. Grant the required permissions on C:\inetpub\mailroot\pickup (or whichever mail directory you use if not the default). Typically, at the very least, you want to grant USERS group with Modify permissions.

  5. Reset IIS or restart the server (if not PROD).

  6. Test the application.

One last thing, we noticed that Windows Server 2012 R2 is more restrictive for e-mail formatting. You need to use an FQDN for your From: e-mail address. On Windows 2003, you can use any one-word “address” (i.e., From: “MySender”). On Windows Server 2012 R2, you need to add [email protected]. The e-mail format needs to be valid whether or not the e-mail address itself is legit.

We have used this method to migrate a dozen of ASP applications and this will buy more time for at least another eight more years before we need to re-write most of our applications.

Further Reading

Mastering Windows Server 2019
Mastering Windows Server 2016 Hyper-V

January 12, 2015 Filed Under: How To Tagged With: Cdonts Dll, Classic ASP, Windows 2012, Windows Server

How to Clear Facebook Cache

When you need to publish your blog post on Facebook, at times you might not like the look of the thumbnail and also the description on the status. You change the description and pick a new photo, but it seems Facebook stubbornly remembers the first version of your posting. This happens because Facebook caches the first time a posting is shared and it keeps referring to the cache for each subsequent share of the same posting.

Luckily, there’s an easy way to refresh that cache although it has to be done manually. You can refresh the cache by going to the Facebook Developer page and look for a tool called Open Graph Debugger to reset and this is actually even useful to see what your share looks like before you hit post button.

Facebook Tools Page

Once, you clicked, Open Graph Debugger, type in the full URL of your blog posting that you want to refresh and click the Debug button.

Facebook Debugger Tool

The debug tool will show you a set of information of the last time the page was scraped and other meta data. You can analyze the content yourself, but if you don’t like what you see, the most important thing you need to pay attention to is the button called Fetch new scrape information that you can use to refresh the Facebook Cache of your blog posting.

Facebook Tool Fetch New Scrape Info

After you pressed this button, your changes should be reflected on the Facebook. Just remember to do this, after you make the changes to your page. Not before.

October 25, 2014 Filed Under: How To Tagged With: Cache, Debugger, Facebook, Facebook Tools, Social Media

How to Use Your Favorite Text Editor in Git

After installing Git and initially configuring it, you can further configure it to use your favorite text editor as the default. What you need to do is set the value of core.editor to the program file of your editor and add a flag -w at the end. The -w basically is to tell Git to wait until all operations within the text editor is done before Git can continue to do its thing afterwards.

Windows

git config --global core.editor '"C:\Program Files\Sublime Text 4\sublime_text.exe" -w'

Pay attention to the placement of single quote (‘) and double quotes (“). You want to enclose the whole path of your editor within the quotes, then wrap the whole argument with the flag with the other.

You can use single quote or double quotes interchangeably as long as they’re consistent
(i.e., "'C:\Program Files\Sublime Text 4\sublime_text.exe' -w" works the same way as in the example above).

macOS / Linux

git config --global core.editor "subl -n -w"

Now, if you want to see if the text editor is set correctly, just type in this command:

git config --global --list

And you should see the core.editor value listed to look like this:
Git config --global --list command

Sublime Text is used as an example just because it’s available on Windows, OSX, and Linux. You can certainly substitute the path or program name with whatever text editor you have.

Using Visual Studio Code

Update 9/27/2021: If you use Visual Studio Code as your main editor, the setup is even more simple and this is actually is the more recommended setup now since this post was published (Visual Studio Code can be downloaded from the link at the bottom of this post).

You just need to type the following:

git config --global core.editor "code -w"

If you use macOS, before this configuration can work, you need to setup Visual Studio Code so it can be called from the command line. Then the Git setup to use it is the same on both Windows and macOS.

Further Reading

How to Open Visual Studio Code from command line macOS
How to Enable Font Ligatures in Visual Studio Code
How to Install Git
Basic Configuration in Git

Download

Visual Studio Code
Git

October 1, 2014 Filed Under: How To Tagged With: Code Editor, Git, Sublime Text, Visual Studio Code

Set ENTER key to submit Form using jQuery

This is based on a project using a ASP.NET Web Forms search page with a textbox txtSearchID and a search button btnSearch. The request was to make the submit button enabled by default when a user pressed on the ENTER key.

<asp:TextBox ID="txtSearchID" runat="server" MaxLength="10" />
<asp:Button ID="btnSearch" runat="server" Text="Search" />

The quickest solution is by adding a jQuery snippet at the end of the HTML doc, just before the closing </body> tag:

<script>
$(document).keypress(function(e) {
	if (e.keyCode === 13) {
		$("#<%= btnSearch.ClientID %>").click();
		return false;
	}
});
</script>

July 22, 2014 Filed Under: How To Tagged With: ASP.NET, jQuery

How to Add ID Attribute in Genesis Main Content

With the upgrade of Genesis Framework to responsive design, there’s a particular id attribute on the web content that’s deprecated when you use HTML5. If you take a look at /genesis/lib/framework.php file from Genesis core, you will see that the id="content" markup is still included in the XHTML markup. However for HTML5, the ID attritube is no longer there.

genesis_markup( array(
     'html5'   => '<main %s>',
     'xhtml'   => '<div id="content" class="hfeed">',
     'context' => 'content',
) );

This change creates a problem for some custom javascript to make Google AdSense responsive. The easiest thing to do is just to modify framework.php file to look like this:

genesis_markup( array(
     'html5'   => '<main id="content" %s>',
     'xhtml'   => '<div id="content" class="hfeed">',
     'context' => 'content',
) );

But obviously this is the worst thing to do because any future updates on Genesis core will overwrite that modification. So we want to make the change on the Genesis child theme instead.

Fortunately Genesis markup is very easy to modify. We just need to apply filter within the context of any section we want to change. In this case, it’s the content and we just need to do this on the Genesis child theme functions.php file.

// Add id="content" attributes to <main> element
add_filter( 'genesis_attr_content', 'my_attr_content' );
function my_attr_content( $attr ) {

     $attr['id'] .= 'content';
     return $attr;
    
}

The flexibility of filter in Genesis Framework is not limited to what’s shown in this example. You can also create custom schema for anything on your site by using the same method.

Further Reading

Custom microdata with Genesis 2.0

July 5, 2014 Filed Under: How To, WordPress Tagged With: Genesis Framework

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2026 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure