<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'O parâmetro forReading é utilizado somente para leitura.
ForReading = 1
'Informe aqui o caminho do arquivo TXT
str_caminho="C:\nome_do_arquivo.txt"
%>
<HTML>
<HEAD>
<title>.:: Código Fonte ::.</TITLE>
</HEAD>
<BODY>
<table width="424" border="1" align="center">
<tr>
<td height="67"><div align="center">Arquivo TXT em página ASP </div></td>
</tr>
<tr>
<td height="67"><div align="center">
<%
'Cria o objeto
Set objeto = CreateObject("Scripting.FileSystemObject")
'Condição para verificar se o arquivo exite no local informado
If (objeto.FileExists(str_caminho)) Then
%>
<textarea name=caixa rows=15 cols=60 value="" >
<%
'Abertura do objeto e loop para ler o arquivo TXT
Set str_fso = objeto.OpenTextFile(str_caminho,ForReading,False)
While (not str_fso.AtEndOfStream)
campo = str_fso.readline
response.write(Server.HTMLEncode(campo) & CHR(13))
wend
%>
</textarea>
<%
Else
response.write "Arquivo não encontrado !!!"
End If
%>
</div>
</td>
</tr>
<tr>
<td height="67"><div align="center"><font size="1"><a href="http://www.codigofonte.com.br">www.codigofonte.com.br</a></font></div></td>
</tr>
</table>
<%
Set str_fso = nothing
set objeto = nothing
%>
</BODY>
</HTML>