|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Classic ASP/VBScript - 2 Email Error
I was wondering if someone could help me - I have this code run after a user makes changes to a record in my database... It runs just fine - HOWEVER, it sends two (2) emails?!?!? Here's the code - is there anything I've done wrong, or what do you think the problem is?
<% Set objErrMail= Server.CreateObject("CDO.Message") With objErrMail .From = "Webmaster@bootcampwithjess.com" .To = "admin@bootcampwithjess.com" .Subject = "BCWJ Admin Login" .HTMLBody = CStr("Records DB has been updated by User " & Request.QueryString("Name") & " logged on at " & now()) .Configuration.Fields.Item ("http:// schemas. microsoft. com/cdo/configuration/sendusing") = 2 .Configuration.Fields.Item("http:// schemas. microsoft. com/cdo/configuration/smtpserver") = "smtp.bootcampwithjess.com" .Configuration.Fields.Item("http:// schemas. microsoft. com/cdo/configuration/smtpserverport") = 25 .Configuration.Fields.Update .Send End With Set objErrMail=nothing Response.Redirect ("hidden") %> |
|
#2
|
||||
|
||||
|
-->Thread moved to ASP Forum. The Code Bank is for sample code only,
__________________
Come JOIN the party!!! Quote of the Month: Pretension: The downside of being better than everyone else is that people tend to assume you're pretentious. Questions to Ponder: You can be overwhelmed and underwhelmed, but why can't you be simply whelmed? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#3
|
||||
|
||||
|
the code looks fine!!
may be there is more code thats doing it!! |
|
#4
|
||||
|
||||
|
there is nothing wrong with the code.
the problem is that it's being called twice. it can occur for great many reasons, even if in your page you have an empty image: Code:
<% ... %> <img src="" /> having the blank image will cause the ASP code to run twice because the "default" source of image is the current page. |
|
#5
|
|||
|
|||
|
Quote:
Thanks for the helpful idea's - I'll try adding an img file and actually attach an image. I'll let you know how it goes. |
|
#6
|
|||
|
|||
|
Quote:
I'm not sure where to look to change the "default" image of the page. the only code that runs on this page is what's quoted above. There is no HTML > it only redirects to the main landing page... Do you know what else I could try? |
|
#7
|
||||
|
||||
|
you didn't understand me.
all I said is that among the possible reasons why code will be called twice, there is one reason which is if you have blank image in your page. this is only one possible reason. other possible reasons are: user simply reload the page; spam bots; other page calling that code too.. it's endless. |
|
#8
|
|||
|
|||
|
Quote:
Okay - Thanks... Back to the drawing board for me. ![]() |
|
#9
|
||||
|
||||
|
try to debug this issue by logging the visitor who executed that code.
you can log the IP address and the referer, for example. |
|
#10
|
|||
|
|||
|
Quote:
Good idea! However, it's on every login request from ALL users. Including myself... What makes this problem even more confusing is this problem just recently started to happen... I'm trying to remember if there were any changes I made to the server settings recently that would cause this problem, but nothing is coming to mind. Except the requests are coming from the internet no longer our intranet... would that have anything to do with it? |
|
#11
|
||||
|
||||
|
you can cure the symptoms by adding this code on top of your current code:
Code:
If Session("current_name") = Request.QueryString("Name") Then
Response.Write("you have already been here, thanks.")
Response.END
Else
Session("current_name") = Request.QueryString("Name")
End If
this will prevent duplicates by setting session variable then checking for it. however this is like aspirin: it won't cure the root of the problem to find it you'll have to investigate this much further. |
|
#12
|
|||
|
|||
|
Quote:
Hi... if i understood correctly, this email will send an email to the admin informing that this user is now logged in the system etc etc and that this happens on login. Check your log in section of code. Maybe you accidentally got it to send out an email even when it was a failed login (wrong password, username, etc) even though nothing has updated the DB. Check also if it was placed into a loop in your validation? |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Classic ASP/VBScript - 2 Email Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|