Welcome to WebmasterWorld Guest from 18.204.48.199

Forum Moderators: ocean10000

Message Too Old, No Replies

Creating a text file using ASP

Cannot sort this problem out - help please

     
4:17 am on Sep 5, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:May 23, 2002
posts: 446
votes: 0


Hi

I want someone who's working from home be able to log into our website and run a page the allows him to create content for us which also creates a .ASP file on the fly making the new content available straight away.

I've got almost everything working but there's just one thing (isn't there always) that I cannot sort out and it's driving me crazy. The problem is with adding "'s into a string that is contained within quotes.

The sample code below works:


<%
DepotName = "Belfast"
dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("D:\Websites\WEBSITE\test.asp",true)
fname.WriteLine("<!-- #include file=""ConnectionString.asp""-->")
fname.WriteLine("strDepotName=""MICK"" ")
fname.Close
set fname=nothing
set fs=nothing
%>

The line with MICK in it allows the text file to be created but I would like to have a DepotName variable in there so that the resulting line reads strDepotName = "Belfast"

I've tried putting <%=DepotName%> in there but that didn't work...what am I missing?

Any help gratefully received.

Thanks

Mick

4:52 am on Sept 5, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:May 23, 2002
posts:446
votes: 0


After my umpteenth attempt I finally cracked it:


DepotName = "Belfast"
WThis = "strDepotName=""" & DepotName & """"
.
.
.
fname.WriteLine(WThis)

All those duplicated "'s was getting to me.

Mick