Ciao.

Sapete aiutarmi a tradurre da PHP in ASP/VBScript questa funzione per la gestione degli errori, che invia tramite email, le informazioni sull'errore appena avvenuto ?:

codice:
$arrErrorType = array(E_ERROR => "E_ERROR [1] (Fatal run-time errors)",  
                                    E_WARNING => "E_WARNING [2] (Run-time warnings)",                      
                                    E_PARSE => "E_PARSE [4] (Compile-time parse errors)",                      
                                    E_NOTICE => "E_NOTICE ([8] Run-time notices)",                      
                                    E_CORE_ERROR => "E_CORE_ERROR [16] (Fatal errors that occur during PHP's initial startup)",                                                          E_CORE_WARNING => "E_CORE_WARNING [32] (Warnings that occur during PHP's initial startup)",                      
                                    E_COMPILE_ERROR => "E_COMPILE_ERROR [64] (Fatal compile-time errors)",                                                          E_COMPILE_WARNING => "E_COMPILE_WARNING [128] (Compile-time warnings)",                      
                                    E_USER_ERROR => "E_USER_ERROR [256] (User-generated error message)",                      
                                    E_USER_WARNING => "E_USER_WARNING [512] (User-generated warning message)",                     
                                    E_USER_NOTICE => "E_USER_NOTICE [1024] (User-generated notice message)");  

function errorHandler($errno, $errstr, $errfile, $errline)

{  

global $arrErrorType;   

if (isset($arrErrorType[$errno])) $strType = $arrErrorType[$errno];  

else $strType = "Unknown error [$errno]";   

$strMsg = "--- $strType ---\nError: $errstr\nFile: \"$errfile\"\nLine: $errline";   

// 'Return-Path:' per hosting Windows  
ini_set("sendmail_from", "noreply@error-report.com");   

$headers = "From: Error Report <noreply@error-report.com>\n";  
$headers .= "Content-Type: text/plain; charset=\"utf-8\"\n";  
$headers .= "Content-Transfer-Encoding: 8bit\n";  
$headers .= "X-Mailer: PHP " . phpversion();   

mail("my-email@my-domain.com", "Error Report", $strMsg, $headers, "-fnoreply@error-report.com");

}  

error_reporting(E_ALL);set_error_handler("errorHandler");
Questo metodo si sostituisce alla gestione di default che, come in tutti i linguaggi lato-server, invia invece le informazioni sull'errore direttamente al browser.

Quando si verifica un errore, PHP invoca la funzione impostata con set_error_handler() (in questo caso errorHandler()) e passa le informazioni sull'errore corrente tramite i parametri $errno, $errstr, $errfile e $errline .

Potete aiutarmi?
Grazie