954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Deadlock Error

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!

jcarbillon
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 2
 

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] <strong>
'CREATE THE MAIL OBJECT</strong>
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")= <strong>SMTP USERNAME</strong>
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")= <strong>SMTP PASSWORD</strong>

objMail.Configuration.Fields.Update
objMail.MimeFormatted=false


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

'SEND THE EMAIL
objMail.Send

'CLEAN-UP MAIL OBJECT
Set objMail = Nothing
[/INDENT]
'---- <strong>REDIRECT USER TO ANOTHER PAGE</strong> -----

Response.Redirect("secondarypage.asp")

End If

On Error GoTo 0
%>

Golden-Boy
Newbie Poster
5 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: