Understand ASP.Net custom error

It is very normal when you design your script in ASP.Net and getting some runtime error as attached below when you are designing your script from your local PC and uploaded to the web server.

With the above error, some programmer not even know what to do :S .

Today, MGe will guide you on what is the custom Error type and how to make it work when you are hosted to the web server that do not have the administrator privilege.

Basically custom error used to hide the real error from the script from the visitor, where it might be the sensitive information from your website such as connection string.

The ASP.Net <customErrors /> do have 3 types, such as On, Off and RemoteOnly. In short, may refer to the table as below.

Off Show everyone the detailed error message.  This is rarely a good idea.
On Don’t show anyone the detailed error message.
RemoteOnly Only show the detailed error message if you are testing from the local server where the site resides.

To set it, just open your web.config file and set it from the <system.web>.

Eg.

<customErrors mode="RemoteOnly" />

Install CDONTS to 64 bits Windows server

Today I found out 1 of the server do not have CDONTS installed at all and the server found to be 64bits Windows Server 2008 server.

Firstly, I did not discover that this is a 64 bits server and I have directly copy the cdonts.dll to the C:\Windows\System32 folder and try to register it but failed.

Then I found out it is a 64 bits server. Hmm.. Then I try to move the cdonts.dll to C:\Windows\SysWow64 folder and trying to register it. Step will be as detail below.

1. Open a command prompt with Administrator privilege.
2. Go to the path of C:\Windows\SysWow64, cd C:\Windows\SysWow64.
3. Register the library, regsvr32 cdonts.dll.
4. Try to send the email and it is working fine 🙂

Backup IIS 7 setting

Backup is very important especially for a productive server. We shall learned to backup everything to avoid any data missing.

For some reason, you might want to change the IIS 7 setting and do not want to mess up the setting in case you have modify any setting incorrectly.

To done this, simply run your command prompt with administrator privilege.

1. Navigate to your Windows button and right click to the command prompt then select on the “Run as administrator”.
2. Run the command line, “%windir%\system32\inetsrv\appcmd add backup mickgenie” without quotation.
3. You should be found the folder C:\Windows\System32\inetsrv\mickgenie\ and your configuration file is stored.