Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Use f.writeline to make an asp site

Hi There.

I need to make an asp file with f.writeline but it dosent seem to work.

f.writeline("<%SiteName= "tilbudsaviser"")
f.writeline("<script language="JavaScript">")
f.writeline("<!-- #INCLUDE file="../includes/top.asp" -->")

Can i use an other method?

0
bongii
Asked:
bongii
  • 3
  • 3
2 Solutions
 
NorushCommented:
This is not a good way to format a question?
Please supply us with more information?

What is f  ?
Do you want to create an ASP page from another language?
Do you get an error message ?
0
 
bongiiAuthor Commented:
Well I think it´s pretty clear.
I want to make a .asp file from classic .asp and gets an error:

Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile(Server.Mappath("test.asp"))
filespec = Server.Mappath("test.asp")
Set f = fso.OpenTextFile(filespec,2)
f.writeline "<%response.write "test"%>

f.writeline "<%response.write "test"%> makes error.
0
 
devshbCommented:
In your example above, you've got a double-quote inside the line with the javascript include; that'll produce an error because it's treating the double-quote as an end of the whole text string, so replace the relevant double-quotes with 2 double-quotes, as per the attached example

or, alternatively, you can use chr(34), as per the second chunk of code, where ampersand is the asp character which joins/concatenates text strings together
f.writeline("<%SiteName= ""tilbudsaviser""")
f.writeline("<script language=""JavaScript"">")
f.writeline("<!-- #INCLUDE file=""../includes/top.asp"" -->")
 
or:
 
f.writeline("<%SiteName= "&chr(34)&"tilbudsaviser"&chr(34)&")"
f.writeline("<script language="&chr(34)&"JavaScript"&chr(34)&">")
f.writeline("<!-- #INCLUDE file="&chr(34)&"../includes/top.asp"&chr(34)&" -->")

Open in new window

0
Independent Software Vendors: 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!

 
bongiiAuthor Commented:
But then i need %>

If i write f.writeline("<%SiteName= ""tilbudsaviser""%>"), it makes an error:
f.writeline("<%SiteName= ""tilbudsaviser""
------------------------------------------^
0
 
NorushCommented:
If you write %> then your current asp-page sees that as the end of an asp statement.

You need to use escapechars for the % sign. So the first line would look like:

"<" & Chr(37) & "SiteName=""tilbudsaviser""" & Chr(37) & ">"
0
 
NorushCommented:
Here in a code snippet:
"<" & Chr(37) & "SiteName=""tilbudsaviser""" & Chr(37) & ">"

Open in new window

0
 
bongiiAuthor Commented:
Perfect thanks
0

Featured Post

Independent Software Vendors: 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!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now