摘要:什么是ASP, 它与传统网页设计语言相比有哪些不同的特点,动态服务页面,是微软公司开发的服务器端脚本环境。
第六章: ASP程序设计
思考题
1、什么是ASP, 它与传统网页设计语言相比有哪些不同的特点
答:动态服务页面,是微软公司开发的服务器端脚本环境。
(1)ASP使用VBScript、Jscript等简单易懂的脚本语言,结合HTML代码,可以快速地完成网站的应用程序
(2)无需编译,容易编写,可以在服务器端直接运行
(3)ASP提供了几种内置对象
(4)使用附加组件可以扩展ASP
(5)ASP可以包含服务器端脚本
(6)ASP可以与数据库建立连接,通过对数据库的操作建立功能强大的Web应用程序
2、简述ASP内置对象Session和Application的异同
答:Session对象与Application对象有很多相似之处,他们都可以在不同的ASP页面间共享信息,不同的是Application对象是所有访问者公用的对象,它存储的信息和定义的时间能够为所有的访问者使用,而Session对象存储的信息和定义的时间只能为某一访问者专用。
3、简述ASP读写文本文件的方法
答:读取文本文件方法与属性:
(1)Opentextfile()
(2)Readline() 、read()、readall
(3)Atendofline
(4)Atendofstream
(5)close
……
<%
Set fso=server.createobject(“scripting.filesystemobject”)
Set openfile=fso.opentextfile(“c:\ocean\text.txt”)
Do while not openfile.atendofstream
Response.write openfile.readline& “<br>”
Loop
Openfile.close
Set fso=nothing
%>
<%
Set fso=server.createobject(“scripting.filesystemobject”)
Set openfile=fso.opentextfile(“c:\ocean\text.txt”,8,true)
Openfile.writeline(“这是新附加的数据!”)
Openfile.close
Set fso=nothing
%>
<%
Set fso=server.createobject(“scripting.filesystemobject”)
Set myfile=fso.getfile(“c:\ocean\text.txt”)
Myfile.copy “c:\ocean\text1.txt”
Myfile.move “c:\ocean\text2.txt”
Myfile.delete
myfile.close
Set fso=nothing
%>
<%
Set fso=server.createobject(“scripting.filesystemobject”)
If fso.fileexists(“c:\ocean\text.txt”) then
Response.write (“目标文件存在”)
Else
Response.write (“目标文件不存在”)
End if
Set fso=nothing
%>
返回目录:电子商务设计师教程章节题目与答案汇总
编辑推荐:
软考备考资料免费领取
去领取