Solved

Use f.writeline to make an asp site

Posted on 2008-10-01
7
333 Views
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?

0
Comment
Question by:bongii
[X]
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
7 Comments
 
LVL 7

Expert Comment

by:Norush
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 ?
0
 

Author Comment

by:bongii
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")
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
 
LVL 2

Assisted Solution

by:devshb
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"" -->")
 
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!

 

Author Comment

by:bongii
ID: 22612630
But then i need %>

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

Expert Comment

by:Norush
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) & ">"
0
 
LVL 7

Accepted Solution

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

Open in new window

0
 

Author Comment

by:bongii
ID: 22612847
Perfect thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 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