Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Cdonts failing Server object error 'ASP 0177 : 800401f3'

Posted on 2006-03-20
20
Medium Priority
?
687 Views
Last Modified: 2007-12-19
I am using XP SP2
This code was working OK but I am now getting this error.
Can anyone please think why this is occouring.
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/fb/forgotten_password.asp, line 34
800401f3
Thanks,
John

<%
if Request("Selected") <> "" then
UserEmail=Request("Email")
if not UsersRS.eof then
UserPassword=UsersRS("CustomerPassword")
SendEmail
Response.Redirect "forgotten_password.asp?success=true"
else
Response.Redirect "forgotten_password.asp?failed=true"
end if
end if
      function SendEmail
            Set objCDOMail = Server.CreateObject("CDONTS.NewMail") ' **************Line 34
            objCDOMail.From = "xxx@xxx.co.uk"
            objCDOMail.To = UserEmail
            objCDOMail.Subject = "Forgotten Password for Products Website"
            objCDOMail.Body = mailbody
            objCDOMail.Send
            Set objCDOMail = Nothing
      end function

function mailbody
tmpstr=""
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.validateOnParse=True
objXML.load(Server.MapPath("xml/forgot_password.xml"))
set objNodeXML=objXML.documentElement
tmpstr=objNodeXML.selectSingleNode("body").Text
Set objXML = Nothing
tmpstr=replace(tmpstr,"#UserEmail#",UserEmail)
tmpstr=replace(tmpstr,"#UserPassword#",UserPassword)
mailbody=tmpstr
end function
%>
0
Comment
Question by:johnhardy
  • 7
  • 7
  • 6
20 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 16235849
try changing your function to

     function SendEmail(UserEmail, mailbody)
          Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
          objCDOMail.From = "xxx@xxx.co.uk"
          objCDOMail.To = UserEmail
          objCDOMail.Subject = "Forgotten Password for Products Website"
          objCDOMail.Body = mailbody
          objCDOMail.Send
          Set objCDOMail = Nothing
     end function

then change your call to it to:
Call SendEmail(UserEmail, mailbody)
0
 

Author Comment

by:johnhardy
ID: 16236022
Thanks,
However I received a similar error
Server object, ASP 0177 (0x800401F3)
Invalid class string
 line 35
I wondered could cdonts have gone missing?  I lost jmail recently. How would I check please?

The ammended code is

<%
if Request("Selected") <> "" then
UserEmail=Request("Email")
if not UsersRS.eof then
UserPassword=UsersRS("CustomerPassword")
'SendEmail
Call SendEmail(UserEmail, mailbody)
Response.Redirect "forgotten_password.asp?success=true"
else
Response.Redirect "forgotten_password.asp?failed=true"
end if
end if
      function SendEmail(UserEmail, mailbody)
            Set objCDOMail = Server.CreateObject("CDONTS.NewMail")' *******LINE 35
            objCDOMail.From = "jules@charon.co.uk"
            objCDOMail.To = UserEmail
            objCDOMail.Subject = "Forgotten Password for Products Website"
            objCDOMail.Body = mailbody
            objCDOMail.Send
            Set objCDOMail = Nothing
      end function
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16236069
Have there been any upgrades to your servers recently ?

Try using CDO.Message instead:

   Set objCDOMail = Server.CreateObject("CDO.Message")
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16236095
Alternatively you will need to copy and register cdonts.dll from a Win2K machine to your XP machine.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 16236115
you lost jmail?  Sounds like you may have some kind of security breach, as components do not just disapear.

check this out.  http://www.pensaworks.com/prg_com.asp (you'll have to download the script, unzip it, then upload it to your server.) It will test for the installed ASP components on your server.  If you have another email component you should switch to that component rather than using CDONTS, as CDONTS is rather unreliable.
0
 

Author Comment

by:johnhardy
ID: 16236637
I tried
Set objCDOMail = Server.CreateObject("CDO.Message")
the error moved down a little
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'objCDOMail.Body'
Code:
'Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
            Set objCDOMail = Server.CreateObject("CDO.Message")
            objCDOMail.From = "jules@charon.co.uk"
            objCDOMail.To = UserEmail
            objCDOMail.Subject = "Forgotten Password for Products Website"
            objCDOMail.Body = mailbody
            objCDOMail.Send
            Set objCDOMail = Nothing

=====================
I also found this article by Jules at Charon
http://www.charon.co.uk/aspnetforums/ShowPost.aspx?PostID=5005 passing to
http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=26 
I am using Localhost.
However when I look at the example I cant see how to apply this to the present code.
Thanks
John
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16236707
You need to use either:

    objCDOMail.TextBody

Or:

   objCDOMail.HTMLBody

Depending on your requirements.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 16236724
right..go back to using Server.CreateObject("CDONTS.NewMail")

the error is somewhere in that mailbody function

try this out

Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
          objCDOMail.From = "jules@charon.co.uk"
          objCDOMail.To = "jules@charon.co.uk"'I am assuming this is your email address
          objCDOMail.Subject = "Forgotten Password for Products Website"
          objCDOMail.Body = "Here is your your password..."
          objCDOMail.Send
          Set objCDOMail = Nothing

just to see what happens
0
 

Author Comment

by:johnhardy
ID: 16236997
Thanks KEVP
I have tried both            
'Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
            and Set objCDOMail = Server.CreateObject("CDO.Message")
using CDONTS gives an error at line 35
Using CDO the error is at line 40 -- Object doesn't support this property or method: 'objCDOMail.Body'
That section now reads
<%
if Request("Selected") <> "" then
UserEmail=Request("Email")
if not UsersRS.eof then
UserPassword=UsersRS("CustomerPassword")
'SendEmail
Call SendEmail
Response.Redirect "forgotten_password.asp?success=true"
else
Response.Redirect "forgotten_password.asp?failed=true"
end if
end if
      function SendEmail
            'Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
            Set objCDOMail = Server.CreateObject("CDO.Message")
            objCDOMail.From = "info@net100.co.uk"
            objCDOMail.To = "john@net100.co.uk"
            objCDOMail.Subject = "Forgotten Password for Products Website"
            objCDOMail.Body = "Here is your password"
            objCDOMail.Send
            Set objCDOMail = Nothing
      end function

function mailbody
tmpstr=""
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.validateOnParse=True
objXML.load(Server.MapPath("xml/forgot_password.xml"))
set objNodeXML=objXML.documentElement
tmpstr=objNodeXML.selectSingleNode("body").Text
Set objXML = Nothing
tmpstr=replace(tmpstr,"#UserEmail#",UserEmail)
tmpstr=replace(tmpstr,"#UserPassword#",UserPassword)
mailbody=tmpstr
end function
%>
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16237048
As per my last post, you need to use TextBody or HTMLBody with CDO:

i.e.

          Set objCDOMail = Server.CreateObject("CDO.Message")
          objCDOMail.From = "info@net100.co.uk"
          objCDOMail.To = "john@net100.co.uk"
          objCDOMail.Subject = "Forgotten Password for Products Website"
          objCDOMail.TextBody = "Here is your password"
          objCDOMail.Send
          Set objCDOMail = Nothing
0
 
LVL 25

Expert Comment

by:kevp75
ID: 16237119
ok...using CDO.Message, change objCDOMail.Body to either objCDOMail.TextBody or objCDOMail.HTMLBody depending on what the content you are trying to send is.

if you are using the mailbody function then use HTMLBody
0
 

Author Comment

by:johnhardy
ID: 16237272
Thanks very much, I actually got a result,
The page was sent and I received back an email which said Here is your password.
However no password was included

I imagine its to do with the next part of the code,
I suspect its something to do with the file forgot_password.xml where the code looks like the email which should be received!

Can you pls advise?

function mailbody
tmpstr=""
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.validateOnParse=True
objXML.load(Server.MapPath("xml/forgot_password.xml"))
set objNodeXML=objXML.documentElement
tmpstr=objNodeXML.selectSingleNode("body").Text
Set objXML = Nothing
tmpstr=replace(tmpstr,"#UserEmail#",UserEmail)
tmpstr=replace(tmpstr,"#UserPassword#",UserPassword)
mailbody=tmpstr
end function
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16237311
You'll have to test that block to see if it is retrieving the value from the XML document correctly.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 16237509
your code for the mailbody function looks correct, and you shouldn't have gotten a password, baces all you sent was "Here is your password"  :)

try setting objCDOMail.HTMLBody = mailbody

there is something wrong with the mailbody function, it throws out a, 'Object Required 'objNodeXML'' error for me....trying to work it out now
0
 
LVL 25

Expert Comment

by:kevp75
ID: 16237595
i hate to ask for it, but can you supply the code for

xml/forgot_password.xml
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16237604
Initially for the purpose of debug, try changing your function to:

Function mailbody

    tmpstr=""

    Set objXML = Server.CreateObject("Microsoft.XMLDOM")
    objXML.validateOnParse=True
    bOK = objXML.load(Server.MapPath("xml/forgot_password.xml"))
    If Not bOK Then
       Response.Write "Failed to load XML": Response.Flush
    End If

    set objNodeXML=objXML.documentElement

    Set objNodeXML = objNodeXML.selectSingleNode("body").Text
    If objNodeXML Is Nothing Then
        Response.Write "Failed retrieving body node": Response.Flush
    End If

    tmpstr=objNodeXML.selectSingleNode("body").Text
    Set objXML = Nothing

    tmpstr=replace(tmpstr,"#UserEmail#",UserEmail)
    tmpstr=replace(tmpstr,"#UserPassword#",UserPassword)

    If Len(tmpstr) = 0 Then
        Response.Write "tmpstr is empty": Response.Flush
    End If

    mailbody=tmpstr

End Function
0
 

Author Comment

by:johnhardy
ID: 16237974
i hate to ask for it, but can you supply the code for
No problem. I went for a walk!

<?xml version="1.0"?>
<root>
<body>
<![CDATA[
Hello,
Here is your Username/Password for Website:-
Your User Name is - #UserEmail#
Your Password is - #UserPassword#

Best Regards
]]>
</body>
</root>


0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1000 total points
ID: 16238070
In that case, change this line:

    tmpstr=objNodeXML.selectSingleNode("body").Text

To:

    tmpstr=objNodeXML.selectSingleNode("/root/body").Text
0
 
LVL 25

Assisted Solution

by:kevp75
kevp75 earned 1000 total points
ID: 16238092
ok...the function is fine, I would try using that objCDOMail.HTMLBody = mailbody see where that gets ya.

I am assuming that the Username comes from the form itself and UserPassword is coming from a database (or XML file, or text file or something)

0
 

Author Comment

by:johnhardy
ID: 16239058
Well thank you both so very much.

Looks like finally we got there.

I have increased the points sorry I have to accept only one answer.

Regards

John



0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Integration Management Part 2
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question