Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > write <% and %> to file in asp

Reply
Thread Tools

write <% and %> to file in asp

 
 
Mark
Guest
Posts: n/a
 
      08-18-2003
Hi,
I try to create a file, but failure.
My code like is:

<%
dim fs
dim tfile
strNum = """1005"""
strInfolink = "snum = " & strSiteNum

set fs=Server.CreateObject("Scripting.FileSystemObject ")
set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\i nfolink.asp")
tfile.WriteLine("<%")
tfile.WriteLine(strInfolink)
tfile.WriteLine("%>")
tfile.close
set tfile=nothing
set fs=nothing
%>


Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/html/testing.asp, line 28

tfile.WriteLine("
-----------------^



The problem is '<%', if I take this out, everything is fine.
Thanks.


--
Mark


 
Reply With Quote
 
 
 
 
Michael D. Ober
Guest
Posts: n/a
 
      08-18-2003
Add a second % sign in both lines.

Mike Ober.

"Mark" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
> I try to create a file, but failure.
> My code like is:
>
> <%
> dim fs
> dim tfile
> strNum = """1005"""
> strInfolink = "snum = " & strSiteNum
>
> set fs=Server.CreateObject("Scripting.FileSystemObject ")
> set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\i nfolink.asp")
> tfile.WriteLine("<%")
> tfile.WriteLine(strInfolink)
> tfile.WriteLine("%>")
> tfile.close
> set tfile=nothing
> set fs=nothing
> %>
>
>
> Microsoft VBScript compilation error '800a0409'
>
> Unterminated string constant
>
> /html/testing.asp, line 28
>
> tfile.WriteLine("
> -----------------^
>
>
>
> The problem is '<%', if I take this out, everything is fine.
> Thanks.
>
>
> --
> Mark
>
>



 
Reply With Quote
 
 
 
 
Anthony Sullivan
Guest
Posts: n/a
 
      08-18-2003
Give this a try Mark...

tfile.WriteLine(chr(60) & "%")
tfile.WriteLine(strInfolink)
tfile.WriteLine("%" & chr(62))

Cheers!

Anthony Sullivan

"Mark" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
> I try to create a file, but failure.
> My code like is:
>
> <%
> dim fs
> dim tfile
> strNum = """1005"""
> strInfolink = "snum = " & strSiteNum
>
> set fs=Server.CreateObject("Scripting.FileSystemObject ")
> set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\i nfolink.asp")
> tfile.WriteLine("<%")
> tfile.WriteLine(strInfolink)
> tfile.WriteLine("%>")
> tfile.close
> set tfile=nothing
> set fs=nothing
> %>
>
>
> Microsoft VBScript compilation error '800a0409'
>
> Unterminated string constant
>
> /html/testing.asp, line 28
>
> tfile.WriteLine("
> -----------------^
>
>
>
> The problem is '<%', if I take this out, everything is fine.
> Thanks.
>
>
> --
> Mark
>
>



 
Reply With Quote
 
Anthony Sullivan
Guest
Posts: n/a
 
      08-18-2003
Even better.

Cheers!

Anthony Sullivan

"Michael D. Ober" <obermd-@-alum-mit-edu-nospam> wrote in message
news:8i60b.19$(E-Mail Removed)...
> Add a second % sign in both lines.
>
> Mike Ober.
>
> "Mark" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi,
> > I try to create a file, but failure.
> > My code like is:
> >
> > <%
> > dim fs
> > dim tfile
> > strNum = """1005"""
> > strInfolink = "snum = " & strSiteNum
> >
> > set fs=Server.CreateObject("Scripting.FileSystemObject ")
> > set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\i nfolink.asp")
> > tfile.WriteLine("<%")
> > tfile.WriteLine(strInfolink)
> > tfile.WriteLine("%>")
> > tfile.close
> > set tfile=nothing
> > set fs=nothing
> > %>
> >
> >
> > Microsoft VBScript compilation error '800a0409'
> >
> > Unterminated string constant
> >
> > /html/testing.asp, line 28
> >
> > tfile.WriteLine("
> > -----------------^
> >
> >
> >
> > The problem is '<%', if I take this out, everything is fine.
> > Thanks.
> >
> >
> > --
> > Mark
> >
> >

>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      08-18-2003
> tfile.WriteLine("<%")

tfile.writeline "<" & "%"



 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      08-18-2003
Thanks All
Mark








"Mark" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
> I try to create a file, but failure.
> My code like is:
>
> <%
> dim fs
> dim tfile
> strNum = """1005"""
> strInfolink = "snum = " & strSiteNum
>
> set fs=Server.CreateObject("Scripting.FileSystemObject ")
> set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\i nfolink.asp")
> tfile.WriteLine("<%")
> tfile.WriteLine(strInfolink)
> tfile.WriteLine("%>")
> tfile.close
> set tfile=nothing
> set fs=nothing
> %>
>
>
> Microsoft VBScript compilation error '800a0409'
>
> Unterminated string constant
>
> /html/testing.asp, line 28
>
> tfile.WriteLine("
> -----------------^
>
>
>
> The problem is '<%', if I take this out, everything is fine.
> Thanks.
>
>
> --
> Mark
>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      08-18-2003
> took a long time to process and still not working.

Maybe you could tell us what "not working" means...


 
Reply With Quote
 
John Davis
Guest
Posts: n/a
 
      08-18-2003
The file is not produced. I type http://localhost/createfile.asp in address
bar, and the status bar doesn't move but sounds like IIS engine is trying to
process the file but failed.

"Aaron Bertrand - MVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> > took a long time to process and still not working.

>
> Maybe you could tell us what "not working" means...
>
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      08-18-2003
<<<<but sounds like IIS engine is trying to process the file but failed>>>>
So, what exactly does that sound like?

vroooommm, vroooommm, sputter, cough, clunk?

:>)

Bob Lehmann

"John Davis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The file is not produced. I type http://localhost/createfile.asp in

address
> bar, and the status bar doesn't move but sounds like IIS engine is trying

to
> process the file but failed.
>
> "Aaron Bertrand - MVP" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > > took a long time to process and still not working.

> >
> > Maybe you could tell us what "not working" means...
> >
> >

>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      08-18-2003
Why do you think it's a syntax issue? Do you have the Norton Virus?
http://www.aspfaq.com/2180




"John Davis" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The file is not produced. I type http://localhost/createfile.asp in

address
> bar, and the status bar doesn't move but sounds like IIS engine is trying

to
> process the file but failed.
>
> "Aaron Bertrand - MVP" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > > took a long time to process and still not working.

> >
> > Maybe you could tell us what "not working" means...
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to open a file in binary, skip X bytes and write the rest ofthe file to a new file scad C++ 4 05-28-2009 08:47 AM
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write buffer? DR ASP .Net 2 07-29-2008 09:50 AM
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write buffer? DR ASP .Net Building Controls 0 07-29-2008 01:37 AM
is better to open, write, close file than open, write, append, close? Iulian Ilea Javascript 1 12-21-2006 04:32 PM
How to open a new console and write something out write printf() Peter Hansen C++ 1 08-24-2003 11:49 AM



Advertisments