Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problems writing percent character

Reply
Thread Tools

Problems writing percent character

 
 
Simon Wigzell
Guest
Posts: n/a
 
      02-16-2005
I have written an asp funciton to write a 301 redirect. It gets the file
name and the new desitination as arguments. I am doing this for hundreds of
files so a script is more accurate than doing it manually and much faster, I
thought. Problem is it chokes on the line:

FileText = FileText & "%>" & vbcrlf

Error message is:
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/NewTest/TestRedirects/WriteRedirects.asp, line 58

FileText = FileText & "
-----------------------^It doesn't have any problem with FileText = FileText
& "<%" & vbcrlf

I've tried escaping it:

FileText = FileText & "\%>" & vbcrlf

but it chokes on the "\"

How can I append "%>" to a string????

Full function follows:

function CreateRedirect(Filename,Destination)
FullFilename = server.mappath(Filename)
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.OpenTextFile(FullFilename, 2, true)
FileText = ""
FileText = FileText & "<%" & vbcrlf
FileText = FileText & "Response.Status = ""301 Moved Permanently""" &
vbcrlf
FileText = FileText & "Response.addheader ""Location"",""" & Destination
& """ & vbcrlf
FileText = FileText & "Response.End" & vbcrlf
FileText = FileText & "%>" & vbcrlf
file.WriteLine(FileText)
file.Close()
set fs = nothing
end function


 
Reply With Quote
 
 
 
 
Gérard Leclercq
Guest
Posts: n/a
 
      02-16-2005

Try with
What is the content of FileText ?

FileText = FileText & Chr(37) & ">" & vbcrlf


 
Reply With Quote
 
 
 
 
Simon Wigzell
Guest
Posts: n/a
 
      02-16-2005

"Gérard Leclercq" <(E-Mail Removed)> wrote in message
news:9MLQd.13257$(E-Mail Removed)-ops.be...
>
> Try with
> What is the content of FileText ?
>
> FileText = FileText & Chr(37) & ">" & vbcrlf
>
>

Thanks! That solved it.


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      02-16-2005
Gérard Leclercq wrote on 16 feb 2005 in
microsoft.public.inetserver.asp.general:
> Try with
> What is the content of FileText ?
>
> FileText = FileText & Chr(37) & ">" & vbcrlf



FileText = FileText & "%" & ">" & vbcrlf

Why can I never remember them ascii numbers?
'cause they are American?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      02-16-2005
Evertjan. wrote:
> Why can I never remember them ascii numbers?
> 'cause they are American?


This American uses Arabic numerals for expressing ASCII numbers.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      02-17-2005
"Dave Anderson" wrote in message
news:(E-Mail Removed)...
: Evertjan. wrote:
: > Why can I never remember them ascii numbers?
: > 'cause they are American?
:
: This American uses Arabic numerals for expressing ASCII numbers.

I'm using Italian (Roman) numerals with a lemon twist for expressing ASCII
numbers in my champagne cocktail. (O:=

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



 
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
20 percent off Pearson Vue Exams Victoria Chin Microsoft Certification 2 05-10-2005 04:06 AM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM
Formatting percent and dealing with division by zero problems Bill ASP General 4 08-29-2003 03:16 PM
Doed anyone know the percent to pass the exams 70-210 chris kirk MCSE 0 08-04-2003 01:33 AM
Re: Doed anyone know the percent to pass the exams 70-210 Techie MCSE 0 08-03-2003 03:29 AM



Advertisments