CDO Error

N

Nate

I have the following ASP code on a simple "experimental" page:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="(e-mail address removed)"
myMail.To="(e-mail address removed)"
myMail.CreateMHTMLBody "http://cic/targeted/results.asp"
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/sendusing")=2
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/smtpserver")="172.30.8.51"
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/smtpserverport")=25
mymail.configuration.fields.update
myMail.Send
set myMail=nothing
%>


When attempting to hit this page, I receive:


CDO.Message.1 error '80070005'


Access is denied.


/experiments/emailtest.asp, line 6


I ran LogMon, and found the following error whenever I hit the page:
4:49:37 PM w3wp.exe:2992 OPEN D:\CIC ACCESS DENIED NT
AUTHORITY
\NETWORK SERVICE


I've tried adding the network service user to D:\CIC, but the same
error persists.


Any ideas?
 
A

Anthony Jones

Nate said:
I have the following ASP code on a simple "experimental" page:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="(e-mail address removed)"
myMail.To="(e-mail address removed)"
myMail.CreateMHTMLBody "http://cic/targeted/results.asp"
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/sendusing")=2
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/smtpserver")="172.30.8.51"
mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/
configuration/smtpserverport")=25
mymail.configuration.fields.update
myMail.Send
set myMail=nothing
%>


When attempting to hit this page, I receive:


CDO.Message.1 error '80070005'


Access is denied.


/experiments/emailtest.asp, line 6


I ran LogMon, and found the following error whenever I hit the page:
4:49:37 PM w3wp.exe:2992 OPEN D:\CIC ACCESS DENIED NT
AUTHORITY
\NETWORK SERVICE


I've tried adding the network service user to D:\CIC, but the same
error persists.

Did you grant read/write access?
What is D:\CIC anyway, a folder or root of the website?
Is this code running on CIC?
If you visit http://cic/targeted/results.asp with a browser does it work?
Do you have ASP debugging turned on?

Having asked that lot, CreateMHTMLBody isn't a safe thing to using in ASP.
Ultimately it will use the WinINet API which is designed to be used by a
client. If you have many such requests running at the same time all sorts
of undesirable things can happen.
 
N

Nate

Did you grant read/write access?
What is D:\CIC anyway, a folder or root of the website?
Is this code running on CIC?
If you visithttp://cic/targeted/results.aspwith a browser does it work?
Do you have ASP debugging turned on?

Having asked that lot, CreateMHTMLBody isn't a safe thing to using in ASP.
Ultimately it will use the WinINet API which is designed to be used by a
client. If you have many such requests running at the same time all sorts
of undesirable things can happen.

Thanks for the response, Anthony.

Read and write access (even full access) was tested and failed. D:\CIC
is the root of the site on the server. Yes, the code is running on
CIC. Yes, the page works properly. I may not have had ASP debugging
turned on, but will try again.
 
N

Nate

Thanks for the response, Anthony.

Read and write access (even full access) was tested and failed. D:\CIC
is the root of the site on the server. Yes, the code is running on
CIC. Yes, the page works properly. I may not have had ASP debugging
turned on, but will try again.- Hide quoted text -

- Show quoted text -

Yes, debugged was enabled.
 
A

Anthony Jones

Nate said:
Yes, debugged was enabled.

When debugging is turned on ASP will only use one worker thread to handle
requests. If your ASP code performs an action which generates another
request into the site that request will queue waiting for you ASP code to
complete. However your ASP code won't complete until its received a
response from the second request. Its a deadlock. Eventually the second
request will timeout and you'd get an error, Access denied is not what I
would expect to be the result though.

Do you have anonymous access turned on?

Note having ASP code generate requests to other ASP pages running in the
same application can also be a source of problems when used heavily. You
can end up with deadlock even without debugging turned on.
 
N

Nate

When debugging is turned on ASP will only use one worker thread to handle
requests. If your ASP code performs an action which generates another
request into the site that request will queue waiting for you ASP code to
complete. However your ASP code won't complete until its received a
response from the second request. Its a deadlock. Eventually the second
request will timeout and you'd get an error, Access denied is not what I
would expect to be the result though.

Do you have anonymous access turned on?

Note having ASP code generate requests to other ASP pages running in the
same application can also be a source of problems when used heavily. You
can end up with deadlock even without debugging turned on.

Makes sense. I've turned off debugging and the error continues.

I do NOT have anonymous access turned on - using Integrated Windows
authentication.

The application pool for this site is using Network Service as its
identity, and LogMon is showing errors when user 'NT AUTHORITY/NETWORK
SERVICE' attempts to hit D:\CIC (the site root.) I'm wondering if it's
a permissions issue. The web server is on a domain, so I can't find
the user exactly as it is showing in the logs. What's the proper way
to add this user when the server is on a domain?

-Nate
 
A

Anthony Jones

Nate said:
Makes sense. I've turned off debugging and the error continues.

I do NOT have anonymous access turned on - using Integrated Windows
authentication.

The application pool for this site is using Network Service as its
identity, and LogMon is showing errors when user 'NT AUTHORITY/NETWORK
SERVICE' attempts to hit D:\CIC (the site root.) I'm wondering if it's
a permissions issue. The web server is on a domain, so I can't find
the user exactly as it is showing in the logs. What's the proper way
to add this user when the server is on a domain?


On the security tab for the Cic folder click add... The default location
where object names are drawn from is the domain that the server belongs to.
However NETWORK SERVICE is local account. Therefore click Locations... and
select the computer name, click OK. Now enter NETWORK SERVICE and click OK.
Assign read access rights to this account (should be done be default).

Let me re-iterate that this is not a recommendation. You will probably get
away with it in light use and with reasonably frequent re-cycles. However
as soon as the site starts to misbehave (whether this is the cause or not)
it can be a distraction. You may find yourself under a lot of pressure to
fix it quickly because its now out in live use.
 
N

Nate

mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/> > > > > > configuration/sendusing")=2

mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/> > > > > > configuration/smtpserver")="172.30.8.51"

mymail.configuration.fields.item("http://schemas.microsoft.com/cdo/









On the security tab for the Cic folder click add... The default location
where object names are drawn from is the domain that the server belongs to.
However NETWORK SERVICE is local account. Therefore click Locations... and
select the computer name, click OK. Now enter NETWORK SERVICE and click OK.
Assign read access rights to this account (should be done be default).

Let me re-iterate that this is not a recommendation. You will probably get
away with it in light use and with reasonably frequent re-cycles. However
as soon as the site starts to misbehave (whether this is the cause or not)
it can be a distraction. You may find yourself under a lot of pressure to
fix it quickly because its now out in live use.

--
Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Even with NETWORK SERVICE being added, it throws a denied error.

I understand that this is not a recommendation. The overall goal of
this is to mail the contents of an ASP page (results.asp) on a daily
basis. What alternative would you recommend?
 
A

Anthony Jones

Nate said:

Even with NETWORK SERVICE being added, it throws a denied error.

I understand that this is not a recommendation. The overall goal of
this is to mail the contents of an ASP page (results.asp) on a daily
basis. What alternative would you recommend?

Sadly none of the alternatives are as elegant and what alternative you use
really depends on how results.asp is currently constructed.

The simplest option is:-

Place results.asp in a separate application and allow anonymous access. It
would mean that all replaced elements such as images etc would also need to
be present in the application. You could restrict access by IP address or by
using a random host name.

Other way more ugly are:-

Use an include ASP to generate XML for the dynamic part of resutls asp and
an XSL that transfors the result to the orignal output of results.asp.
Results.asp could use the include and the XSL to send output to response
whereas you email.asp could use them to create a string to assign to the
HTMLBody. Handling replaced elements such as imgs could be tricky though.
The CreateMHTMLBody would automatically build these into the message as
related parts which bloats the email but gives a much better chance that the
recipient will see it as intended. One way round this is to include a BASE
element in the html and simple ensure the references to images are available
public. Generates a smaller email but could increase the load on your
server and would likely be initially blocked by the receiver.

Another alternative similar to the above is to have an include containing
code similar to the results.asp but all static HTML is written by code
inside <% %>. In stead of writing to Response it would write to an abstract
output object. This is either set to response or a wrapper class that
contains an ADODB.Stream object. The wrapper class would have a write
method that delegates to the streams WriteText method. In results.asp the
output variable is set to Response but in email.asp the output variable is
set to the wrapper class where its internal stream object is set to the
..HTMLBodyPart.GetDecodedStream. Again this will not automatically build in
the related parts.

Personally I use a variation of the the XML based one where replaced
elements in the html are included as related parts built 'manually' by the
code. Very ugly but effective.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top