Solved

How to print <% Response.ContentType .... in a file ????

Posted on 2002-04-15
5
307 Views
Last Modified: 2012-08-13
<%
Set objFS =Server.CreateObject("Scripting.FileSystemObject")
Set objFN = objFS.CreateTextFile("c:\test.txt", true)
objFN.WriteLine("<% Response.ContentType = ""application/vnd.ms-excel"" %>")
Set objFN = Nothing
Set objFS = Nothing
%>


When I ran it, I got this error :

Unterminated string constant

/e.asp, line 4

objFN.WriteLine("<% Response.ContentType = ""application/vnd.ms-excel""
-----------------------------------------------------------------------^


How to fix it ? I must print <% Response.ContentType = "application/vnd.ms-excel" %> into a file.
0
Comment
Question by:decae2001
[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
5 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 6943981
try

objFN.WriteLine(chr(60) & chr(34) & " Response.ContentType = "application/vnd.ms-excel" & chr(34) & chr(37) & chr(62))
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6943985
fix:

objFN.WriteLine(chr(60) & chr(34) & " Response.ContentType = " & chr(34) & "application/vnd.ms-excel" & chr(34) & 
chr(37) & chr(62))
0
 
LVL 20

Accepted Solution

by:
Silvers5 earned 200 total points
ID: 6943993
fixed final:

<%@ Language=VBScript %>
<%
Set objFS =Server.CreateObject("Scripting.FileSystemObject")
Set objFN = objFS.CreateTextFile(server.MapPath("test.txt"), true)
objFN.WriteLine(chr(60) & chr(37) & " Response.ContentType = " & chr(34) & "application/vnd.ms-excel" & chr(34) & chr(37) & chr(62))
Set objFN = Nothing
Set objFS = Nothing
%>
0
 
LVL 1

Expert Comment

by:falconew
ID: 6944308
Try this:
objFN.WriteLine("<% Response.ContentType = """application/vnd.ms-excel""" %>")

REgards,
Falconew
0
 
LVL 11

Expert Comment

by:ASPGuru
ID: 6944498
you don't really need to use the chr function... just make sure you separate the < and the % ....

objFN.WriteLine("<" & "% Response.ContentType .....


ASPGuru
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

632 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