Use f.writeline to make an asp site

Posted on 2008-10-01
Last Modified: 2012-08-14
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?

Question by:bongii
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 22612481
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 ?

Author Comment

ID: 22612496
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")
filespec = Server.Mappath("test.asp")
Set f = fso.OpenTextFile(filespec,2)
f.writeline "<%response.write "test"%>

f.writeline "<%response.write "test"%> makes error.

Assisted Solution

devshb earned 20 total points
ID: 22612521
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"" -->")
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.


Author Comment

ID: 22612630
But then i need %>

If i write f.writeline("<%SiteName= ""tilbudsaviser""%>"), it makes an error:
f.writeline("<%SiteName= ""tilbudsaviser""

Expert Comment

ID: 22612667
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) & ">"

Accepted Solution

Norush earned 30 total points
ID: 22612668
Here in a code snippet:
"<" & Chr(37) & "SiteName=""tilbudsaviser""" & Chr(37) & ">"

Open in new window


Author Comment

ID: 22612847
Perfect thanks

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question