Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically create www.mywebsite.com/clienturl using code

Status
Not open for further replies.

intomuso

Programmer
Jan 26, 2006
19
GB
Hi,

I'm trying to create folders for bands. So they can have their own url e.g or as in for example. I know how to and have done this manually. I create a folder, then put a default.asp page in that folder with a response.redirect to the asp page of the band.

I'm now trying to do this dynamically to save me having to do 1000 of these and who knows how many in the future. The trouble is that the fileobjectsystem component will only allow me to create text files and when I try and create an .asp page anything with a " in it causes an error. I don't think the component can do it. it's the same with a header refresh to send to a new page.

Does anyone have a solution for creating these pages on the fly.

Thanks

gavin
 
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateFolder("c:\asp")
set f=nothing
set fs=nothing
%>

Obviously you would replace c:\asp with a string that was generated by the user.
 
To create the default.asp file I would have thought something like:

Set fs = CreateObject("Scripting.FileSystemObject")
Set wfile = fs.CreateTextFile(") & TheFolder & " & "\default.asp", True)

Text = "<%"
Text = Text & "Response.Write('Welcome to my asp page')"
Text = Text & "%>"

wfile.Write(Text)

TheFolder would be the folder you created in my post above. I think this code is correct but may need some fine tuning.
 
If you need to put a double quote character -->[red]"[/red] in your string you can use the ASCII character code.
[tt]
TheString = "I really " & Chr(34) & "love" & Chr(34) & " to write code."[/tt]

Now if you do [tt]Response.Write TheString[/tt] you would get:
I really "love" to write code.

 
Hi,

Thanks I never thought of that, genius or what :)

gav
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top