惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
C
Check Point Blog
J
Java Code Geeks
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
量子位
Google DeepMind News
Google DeepMind News
I
InfoQ
The GitHub Blog
The GitHub Blog
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
小众软件
小众软件
博客园_首页
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
IT之家
IT之家

博客园 - 胡枫

ASP.NET URL Rewrite. URL重写 asp.net 中DataGrid自定义分页(简单,实用,易懂) 实现类似textarea这样可以滚动显示内容的方法 各种浏览器CSS hack方法 HTML+CSS+JS学习笔记 JS学习笔记ZT Asp.net 备份、还原Ms SQLServer及压缩Access数据库 我该怎样卸载IE7? ASP.NET Application,Session,Cookie和ViewState等对象用法和区别 (转) ASP.NET 防注入的两个通用函数 innerText,outerText,innerHTML,outerHTML 如何在TextBox控件中显示系统当前时间?包括:年、月、日、时、分 ASP.NET 防注入的两个通用函数 C# 操作ACCESS数据库 ASP判断是否包含字符串(InStr 函数) asp.net2.0中Repeater的分页使用 ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子! 一个GridView编辑删除的例子 asp.net中没有类似asp中Left()函数怎么办?
ASP读取显示TXT文件内容
胡枫 · 2007-12-23 · via 博客园 - 胡枫

<html><head><title>基于文本的消息发布系统</title></head>
<body>
<table border="1" cellspacing="0" cellpadding="1" bordercolorlight="#dfdfdf" bordercolordark="#ffffff" align="center">
<tr bgcolor="#cccce6">
<td algin="center" colspan="2">最新消息</td>
</tr>
<%
Set fso=Server.CreateObject("ing.FileSystemObject")
Set fp=fso.OpenTextFile(Server.MapPath("message.txt"))
'打开message.txt

Do While fp.AtEndOfStream<>true
s
=fp.ReadLine '读取一条数据

p
=Instr(s,"*"'取得*号的位置
Messagetitle=Mid(s,1,p-1'取得*号前边的字符串(消息标题)
s=Mid(s,p+1,Len(s)-p) '设变量s为*号后边的字符串

p
=Instr(s,"*")
MessageUrl
=Mid(s,1,p-1'取得*号后边的字符串(链接地址)
s=Mid(s,p+1,Len(s)-p)

ttime

='设定消息发布时间ttime为s
%>
<tr><td><href='<%=MessageUrl%>'><%=Messagetitle%></a></td>
<td><%=ttime%></td>
</tr>
<!--生成表格,把消息显示出来-->
<%
Loop
Fp.close
Set fp=Nothing
Set fso=Nothing
%>
</table>
</body></html>

简单的方法

<%
dim fso,f
    
set fso=server.CreateObject("Scripting.FileSystemObject")
    
Set f =  fso.OpenTextFile(Server.MapPath("1.txt"),1)  
    
Do  While  Not  f.AtEndOfStream    
    response.write f.readline
    
loop
    f.close
    
set f=nothing
    
set fso=nothing
%>