← Foro de ASP

Guardar html en el servidor

Hilo en el foro de ASP · 20 de Julio del 2003 · 3 respuestas
cogolludo20 de Julio del 2003
Pregunta
Mi problema es el siguiente:
Necesito guardar en el servidor el archivo generado por un ASP y no se como hacerlo.
Muchas gracias a todos.

Respuestas 3

Gerado20 de Julio del 2003
Joder, tio, como dices algo tan general, asi no podemos ayudarte, ASP no puede generar cualquier tipo de archivo, quizas un TXT plano, o q?? pon el ejemplo claro para poder ayudarte!
Suerte
DomadorDeSuegras20 de Julio del 2003
utiliza este código, te puede dar alguna idea al respecto.

Saludos desde Perú.


<% LANGUAJE="VBSCRIPT"%>
<html>

<head>
<meta http-equiv="Content-Language" content="es">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<%

Dim intMSG, strMSG

intMSG=1234
strMSG="HOLA ESTA ES UNA PRUEBA"

CreateFile("d:inetpubwwwrootbalotariovariables.txt")
%>


<body>

hola <%=time %>

<%

sub CreateFile(path)

dim fs, file

' Response.Write("<b>CreateFile:</b><br>")

set fs = CreateObject("Scripting.FileSystemObject")

'If the file already exists give an error message.

if fs.FileExists(path) then
WriteFile(path)

'Otherwise create it and write some data to it.

else
' Response.Write("Creating " & filename & ".<br>")
set file = fs.CreateTextFile(path)
' Response.Write("Writing data to " & filename & ".<br>")
file.WriteLine("strMSG=" & strMSG & time & "&" & "intMSG=" & intMSG)
file.Close()
end if

end sub

sub WriteFile(path)

dim fs, file

' Response.Write("<b>WriteFile:</b><br>")

set fs = CreateObject("Scripting.FileSystemObject")

'If the file doesn't exist give an error message.

if not fs.FileExists(path) then
Response.Write("File " & filename & " does not exist, write aborted.<br>")

'Otherwise, overwrite the contents.

else
set file = fs.OpenTextFile(path, 2)
' Response.Write("Rewritng file " & filename & ".<br>")
file.WriteLine("strMSG=" & strMSG & time & "&" & "intMSG=" & intMSG)
file.Close()
end if

end sub
%>


<p>&nbsp;</p>

</body>

</html>
Felipe20 de Julio del 2003
Te recomiendo usar XML y XSLT. Se que es un coñazo, pero es la unica manera que se me ocurre.
El tema seria parsear estos XML y XSLT. El resultado se te descarga en un HTML. Generado este puedes guardarlo antes de enviarlo al navegador
Espero que esto te sirva

¿Buscas más hilos como este? Mira el foro de ASP o usa el buscador.