Hi Guys.

Is it possible to trap this error in Classic ASP, and redirect to another page instead of displaying this error?


Microsoft OLE DB Provider for SQL Server error '80004005'

Transaction (Process ID 104) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

It happens when a lot of people accessing my intranet site all at the same time.

Thanks in advance!

Yes it is possible. On the top of the main ASP page, put <% On Error Resume Next %> At the end of your page, put an email system if you want, where in body part of the mail, you make it response the error and send you

Example sending the email using CDO.Message:

<%
If Err.Number <> 0 Then

[INDENT] [B]
'CREATE THE MAIL OBJECT[/B] 
Set objMail = Server.CreateObject("CDO.Message")
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = application("SMTP")
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
			
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")= [B]SMTP USERNAME[/B]
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")= [B]SMTP PASSWORD[/B]
									
objMail.Configuration.Fields.Update
objMail.MimeFormatted=false


'[B]SET KEY PROPERTIES[/B]
objMail.From = "[B]MYSELF@MYDOMAIN.COM[/B]"
objMail.To = "[B]SENDER@SENDERDOMAIN.COM[/B]"
objMail.Subject= "ASP ERROR"
objMail.HtmlBody = "Description = " & Err.Description & "<br>Error Number:" & Err.Number & "<br>"Error Line : " & Err.Line

'SEND THE EMAIL
objMail.Send

'CLEAN-UP MAIL OBJECT
Set objMail = Nothing
[/INDENT]

'---- [B]REDIRECT USER TO ANOTHER PAGE[/B] -----

Response.Redirect("secondarypage.asp")

End If

On Error GoTo 0
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.