Hi,
I'm using this code below to grab the HTML output of an ASP(template) page and then write it to a static HTML file. The content will print to a page fine using a response.write, but when it goes to write to a file, for some reason I get this error:
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument
/refresh_admin/adminEditNewsletterContentPopup.asp, line 95
Line 95 is this one:
lStrFileCreate.WriteLine(lStrContent)
If I change the line to: lStrFileCreate.WriteLine("Some Text") , it works fine
My CODE:
strURL = " http://localhost:90/refresh_admin/adminPreviewNewsletter.asp ?id=9"
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", strURL, false
objXMLHTTP.Send
lStrContent = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
lStrPath = Server.MapPath("\newsletter") & "\"
lStrFileName = replace(date,"/","_") & "_newsletter.html"
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set lStrFileCreate = objFSO.CreateTextFile(lStrPath & lStrFileName, true)
lStrFileCreate.WriteLine(lStrContent)
lStrFileCreate.Close
Set objFSO = Nothing
I've been trying to sort this for the last two days but I'm at my wits end. I'm pretty sure it's the contents of my outputted template page that is causing this as I've tried it with a simple template and it works ok.
This is the source code that is spat out by ASP and is what I want to write to the HTML file:
<!-- BEGIN NEWSLETTER -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="Description" content="">
<title></title>
<style>
.bgTop{background-color:#FFFFFF;background-image : url( http://localhost:90/newsletter/images/newsletter_bg_top.gif) ;background-repeat: repeat-x;}
.whiteTitleText{color:#FFFFFF;font-size:11px;}
</style>
<link rel="STYLESHEET" type="text/css" href="http://localhost:90/resources/refresh_corp_styles.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table cellpadding="0" cellspacing="0" border="0" width="520" height="100%" align="center">
<tr>
<td width="15" class="bgTop"></td>
<td width="490" class="bgTop" valign="top">
<table cellpadding="0" cellspacing="0" border="0" width="490">
<tr>
<td rowspan="2"><a href="/"><img src="http://localhost:90/newsletter/images/newsletter_logo.gif" alt="Homepage" width="230" height="96" border="0"></a></td>
<td width="100%" valign="middle" align="right" background="http://localhost:90/images/images/default/bg_top.gif">
<div><img src=" http://localhost:90/newsletter/images/newsletter_phone_numbe r.gif" alt="" width="203" height="37" border="0"></div>
<div class="arial11Grey">Date: 19/12/2003</div></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="490">
<tr>
<td width="25" height="25"><img src="http://localhost:90/newsletter/images/title_icon_grey.gif" alt="" width="25" height="25" border="0"></td>
<td width="465" bgcolor="#909090" class="whiteTitleText">
<b>
A title
</b></td& gt;
</tr>
<tr><td height="1"></td></tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="490">
<tr>
<td colspan="2" class="arial11Grey">
<div style="padding:5px;">
And some text....
</div>
</td>
</tr>
<tr><td bgcolor="#909090" colspan="2" height="4"></td></tr>
<tr><td height="1"></td></tr>
<tr>
<td>
<table width="490" border="0" cellspacing="0" cellpadding="0" background="http://localhost:90/images/default/bg_greyfade_main.gif"