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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Other ASP files within a ASP file 2

Status
Not open for further replies.

mainmast

Programmer
Joined
Jun 26, 2003
Messages
176
Location
US
How would I go about creating another ASP web page from an ASP page? I have a pretty basic template, just really the CSS styles, but the rest would be entered in through a textarea box from a admin panel. It doesn't have to create a asp page, It could create a .html or a .htm as well I guess.


I've seen articles and tutorials on the net about using FSO to create text files, but not ASP or HTML files...

Thanks in advance.

"Everything is possible, it just depends on how much you want to pay for it."

-James
 
Same thing :)
FSO could care less about what you nae your file, it could have a .ini extension for all it cares (which iswhy you have to be careful what folders you give the default IIS user write access to).
So using a basic FSO script you could easily write an HTML or ASP file. It's all text, it's just the internal formatting that is differant (and how it is treated by a web browser).

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Hi James

With the FileSysObject you can create asp when your writing the file just use .htm/asp/html etc instead of .txt.

Code:
<%
Dim myFSO
'this line creates an instance of the File Scripting Object named myFSO

SET myFSO = Server.CreateObject("Scripting.FileSystemObject")

'error handling here to make sure that things go smoothly
'if the file does not exist 

If NOT myFSO.FileExists("C:\Inetpub\[URL unfurl="true"]wwwroot\myNewFolder\dynamicpage.asp")[/URL] Then

'then we create it on this drive in the path we specify
myFSO.CreateTextFile

("C:\Inetpub\[URL unfurl="true"]wwwroot\myNewFolder\dynamicpage.asp")[/URL]

Else

'otherwise we tell the client it does so they don't get a nasty error

Response.Write "THIS FILE ALREADY EXISTS"

End If

'this line destroys the instance of the File Scripting Object named myFSO

SET myFSO = NOTHING
%>

Hope this helps.

Thanks

Glen
 
Thanks for all your help, I've got it working now, I also had to turn off script blocking in my AntiVirius stuff because it would block my FSO scripts.

&quot;Everything is possible, it just depends on how much you want to pay for it.&quot;

-James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top