Aleksandar's computer workshop

Let's see what Aleksandar was fixing today.
My findings, tips & tricks related to computers, internet, programming and other stuff I was working with.

Health monitoring in ASP.NET 2.0

Here is a very simple web.config file that sends an e-mail whenever an unhandled error occurs. Pay attention to the <healthMonitoring> and <> section. These are the important ones that makes it work.


<?xml version="1.0"?>

      <compilation debug="false" />
      <trace enabled="true" localOnly="false" />

      <healthMonitoring enabled="true">
            <add name="EmailProvider" 
               subjectPrefix="Error: "
               bufferMode="Notification" />
            <add provider="EmailProvider" name="All App Events" eventName="All Errors" />

         <smtp from="">
            <network host="" />

How easy can it get? Truly amazing.

Properly Capturing Identity Values

When inserting a row into a database table that contains an identity column, I need a way to capture the identity value generated by the database engine after it inserts the row into this table. What can I use to capture this value while also making sure this value is accurate?

SQL Server provides three different functions for capturing the last generated identity value on a table that contains an identity column:
3) IDENT_CURRENT(‘tablename’)

But which should you use? Check out this article for more information: