各位大侠,救救我吧!

dongjp 2003-08-30 01:14:14
下面这个页面为什么打不开呀!

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P> </P>
<%

call buildfile()

sub buildfile()

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("这是一个测试。")
a.Close

Response.Write "OK"
end sub

%>

</BODY>
</HTML>
...全文
27 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongjp 2003-08-30
  • 打赏
  • 举报
回复
大侠们:
这是我得机器的有关参数,我的页面还是打不开。有什么问题吗?

服务器的有关参数 服务器名 192.1.1.214
服务器IP 192.1.1.214
服务器端口 80
服务器时间 2003-8-30 17:29:21
IIS版本 Microsoft-IIS/5.0
脚本超时时间 90 秒
本文件路径 C:\Inetpub\wwwroot\test\test.asp
服务器CPU数量 1 个
服务器解译引擎 VBScript/5.6.7426
服务器操作系统 Windows_NT


组件支持情况
您指定的组件的检查结果:
恭喜!该服务器支持Scripting.FileSystemObject组件。该组件版本是:

■ IIS自带的ASP组件 组 件 名 称 支持及版本
MSWC.AdRotator √
MSWC.BrowserType √ 4.00
MSWC.NextLink √
MSWC.Tools √
MSWC.Status √ Unavailable
MSWC.Counters √
IISSample.ContentRotator ×
IISSample.PageCounter ×
MSWC.PermissionChecker √
Scripting.FileSystemObject (FSO 文本文件读写) √
adodb.connection (ACCESS 数据库) √ 2.7

aloxy 2003-08-30
  • 打赏
  • 举报
回复
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器操作系统</td><td> <%=Request.ServerVariables("OS")%></td>
</tr>
</table>

</td></tr>
</table>
<br>
<font color=green>组件支持情况</font>
<%
Dim strClass
strClass = Trim(Request.Form("classname"))
If "" <> strClass then
Response.Write "<br>您指定的组件的检查结果:"
If Not IsObjInstalled(strClass) then
Response.Write "<br><font color=red>很遗憾,该服务器不支持" & strclass & "组件!</font>"
Else
Response.Write "<br><font color=green>恭喜!该服务器支持" & strclass & "组件。该组件版本是:" & getver(strclass) & "</font>"
End If
Response.Write "<br>"
end if
%>
<br>■ IIS自带的ASP组件
<table border=0 width=450 cellspacing=0 cellpadding=0 bgcolor="#3F8805">
<tr><td>

<table border=0 width=450 cellspacing=1 cellpadding=0>
<tr height=18 style="color:#ffffff" align=center>
<td width=350>组 件 名 称</td><td width=100>支持及版本</td>
</tr>

<%
dim i
For i=0 to 10
Response.Write "<TR bgcolor=#EEFEE0 align=center height=18><TD align=left> " & theInstalledObjects(i) & "<font color=#888888> "
select case i
case 9
Response.Write "(FSO 文本文件读写)"
case 10
Response.Write "(ACCESS 数据库)"
end select
Response.Write "</font></td>"
If Not IsObjInstalled(theInstalledObjects(i)) Then
Response.Write "<td align=left> <font color=red><b>×</b></font></td>"
Else
Response.Write "<td align=left> <font color=green><b>√</b></font> " & getver(theInstalledObjects(i)) & "</td>"
End If
Response.Write "</TR>" & vbCrLf
Next
%>
</table>

</td></tr>
</table>


<br>■ 常见的文件上传和管理组件
<table border=0 width=450 cellspacing=0 cellpadding=0 bgcolor="#3F8805">
<tr><td>

<table border=0 width=450 cellspacing=1 cellpadding=0>
<tr height=18 style="color:#ffffff" align=center>
<td width=350>组 件 名 称</td><td width=100>支持及版本</td>
</tr>

<%

For i=11 to 15
Response.Write "<TR bgcolor=#EEFEE0 align=center height=18><TD align=left> " & theInstalledObjects(i) & "<font color=#888888> "
select case i
case 11
Response.Write "(SA-FileUp 文件上传)"
case 12
Response.Write "(SA-FM 文件管理)"
case 13
Response.Write "(LyfUpload 文件上传)"
case 14
Response.Write "(ASPUpload 文件上传)"
case 15
Response.Write "(w3 upload 文件上传)"

end select
Response.Write "</font></td>"
If Not IsObjInstalled(theInstalledObjects(i)) Then
Response.Write "<td align=left> <font color=red><b>×</b></font></td>"
Else
Response.Write "<td align=left> <font color=green><b>√</b></font> " & getver(theInstalledObjects(i)) & "</td>"
End If

Response.Write "</TR>" & vbCrLf
Next
%>
</table>

</td></tr>
</table>
<br>■ 常见的收发邮件组件
<table border=0 width=450 cellspacing=0 cellpadding=0 bgcolor="#3F8805">
<tr><td>

<table border=0 width=450 cellspacing=1 cellpadding=0>
<tr height=18 style="color:#ffffff" align=center>
<td width=350>组 件 名 称</td><td width=100>支持及版本</td>
</tr>

<%
theInstalledObjects(16) = "JMail.SMTPMail"
theInstalledObjects(17) = "CDONTS.NewMail"
theInstalledObjects(18) = "Persits.MailSender"
theInstalledObjects(19) = "SMTPsvg.Mailer"
theInstalledObjects(20) = "dkQmail.Qmail"
theInstalledObjects(21) = "Geocel.Mailer"
theInstalledObjects(22) = "iismail.iismail.1"
theInstalledObjects(23) = "SmtpMail.SmtpMail.1"

For i=16 to 23
Response.Write "<TR bgcolor=#EEFEE0 align=center height=18><TD align=left> " & theInstalledObjects(i) & "<font color=#888888> "
select case i
case 16
Response.Write "(w3 Jmail 收发信)"
case 17
Response.Write "(WIN虚拟SMTP 发信)"
case 18
Response.Write "(ASPemail 发信)"
case 19
Response.Write "(ASPmail 发信)"
case 20
Response.Write "(dkQmail 发信)"
case 21
Response.Write "(Geocel 发信)"
case 22
Response.Write "(IISemail 发信)"
case 23
Response.Write "(SMTPmail 发信)"

end select
Response.Write "</font></td>"
If Not IsObjInstalled(theInstalledObjects(i)) Then
Response.Write "<td align=left> <font color=red><b>×</b></font></td>"
Else
Response.Write "<td align=left> <font color=green><b>√</b></font> " & getver(theInstalledObjects(i)) & "</td>"
End If

Response.Write "</TR>" & vbCrLf
Next
%>
</table>

</td></tr>
</table>
<br>
<font color=green>其他组件支持情况检测</font><br>
在下面的输入框中输入你要检测的组件的ProgId或ClassId。
<table border=0 width=450 cellspacing=0 cellpadding=0 bgcolor="#3F8805">
<tr><td>

<table border=0 width=450 cellspacing=1 cellpadding=0>
<FORM action=<%=Request.ServerVariables("SCRIPT_NAME")%> method=post id=form1 name=form1>
<tr bgcolor="#EEFEE0" height=18>
<td align=center height=30><input class=input type=text value="" name="classname" size=40>
<INPUT type=submit value="确定" class=backc id=submit1 name=submit1>
<INPUT type=reset value="重填" class=backc id=reset1 name=reset1>
</td>
</tr>
</FORM>
</table>

</td></tr>
</table>

</td></tr>
</table>

<br>

</BODY>
</HTML>
foglee 2003-08-30
  • 打赏
  • 举报
回复
在vb里不用写Server. ,但在asp里最好还写上。还有,你的代码好像没错啊,我测试过了,可以的!是不是你的设置有问题,你把站点重新启动一下看看
aloxy 2003-08-30
  • 打赏
  • 举报
回复
在我的电脑上测试正常
1,检查你的c盘的写权限
2,检查组件是否支持
<%@ Language="VBScript" %>
<% Option Explicit %>
<%
Dim theInstalledObjects(24)
theInstalledObjects(0) = "MSWC.AdRotator"
theInstalledObjects(1) = "MSWC.BrowserType"
theInstalledObjects(2) = "MSWC.NextLink"
theInstalledObjects(3) = "MSWC.Tools"
theInstalledObjects(4) = "MSWC.Status"
theInstalledObjects(5) = "MSWC.Counters"
theInstalledObjects(6) = "IISSample.ContentRotator"
theInstalledObjects(7) = "IISSample.PageCounter"
theInstalledObjects(8) = "MSWC.PermissionChecker"
theInstalledObjects(9) = "Scripting.FileSystemObject"
theInstalledObjects(10) = "adodb.connection"

theInstalledObjects(11) = "SoftArtisans.FileUp"
theInstalledObjects(12) = "SoftArtisans.FileManager"
theInstalledObjects(13) = "LyfUpload.UploadFile"
theInstalledObjects(14) = "Persits.Upload.1"
theInstalledObjects(15) = "w3.upload"

theInstalledObjects(16) = "JMail.SmtpMail"
theInstalledObjects(17) = "CDONTS.NewMail"
theInstalledObjects(18) = "Persits.MailSender"
theInstalledObjects(19) = "SMTPsvg.Mailer"
theInstalledObjects(20) = "DkQmail.Qmail"
theInstalledObjects(21) = "Geocel.Mailer"
theInstalledObjects(22) = "IISmail.Iismail.1"
theInstalledObjects(23) = "SmtpMail.SmtpMail.1"



'检查组件是否被支持
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function

'检查组件版本
Function getver(Classstr)
On Error Resume Next
getver=""
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(Classstr)
If 0 = Err Then getver=xtestobj.version
Set xTestObj = Nothing
Err = 0
End Function
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>test</TITLE>
<style>
<!--
A { COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:hover { COLOR: green; FONT-FAMILY: 宋体; TEXT-DECORATION: underline}
.A2 { COLOR: green; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
.A2:hover { COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: underline}
body { font-family: 宋体; font-size: 9pt}
td { font-family: 宋体; font-size: 9pt}
.input { BACKGROUND-COLOR: #ffffff;BORDER:#3F8805 1px solid;FONT-SIZE: 9pt}
.backc { BACKGROUND-COLOR: #3F8805;BORDER:#3F8805 1px solid;FONT-SIZE: 9pt;color:white}
-->
</STYLE>
</HEAD>
<BODY>
<font color=green>服务器的有关参数</font>
<table border=0 width=450 cellspacing=0 cellpadding=0 bgcolor="#3F8805">
<tr><td>
<table border=0 width=450 cellspacing=1 cellpadding=0>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器名</td><td> <%=Request.ServerVariables("SERVER_NAME")%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器IP</td><td> <%=Request.ServerVariables("LOCAL_ADDR")%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器端口</td><td> <%=Request.ServerVariables("SERVER_PORT")%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器时间</td><td> <%=now%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> IIS版本</td><td> <%=Request.ServerVariables("SERVER_SOFTWARE")%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 脚本超时时间</td><td> <%=Server.ScriptTimeout%> 秒</td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 本文件路径</td><td> <%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%></td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器CPU数量</td><td> <%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个</td>
</tr>
<tr bgcolor="#EEFEE0" height=18>
<td align=left> 服务器解译引擎</td><td> <%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %></td>
</tr>
任老先生 2003-08-30
  • 打赏
  • 举报
回复
不要用“c:\ftestfile.txt”

可能你的服务器禁止操作或没权限
改用虚拟目录
李睿_Lee 2003-08-30
  • 打赏
  • 举报
回复
你那有没有FSO权限啊?
dongjp 2003-08-30
  • 打赏
  • 举报
回复
大侠,还是不行呀!只要执行 Set a = fso.CreateTextFile("c:\testfile.txt", True)
,页面就打不开,一直到脚本执行超时!

神呀!救救我吧,我晚上就要交活了!!
chinayang9 2003-08-30
  • 打赏
  • 举报
回复
对啊,应该是
set aa=Server.CreateObject("bb")
要规范化书写
wolf004 2003-08-30
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P> </P>
<%
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("这是一个测试。")
a.Close
Response.Write "OK"
%>

</BODY>
</HTML>
你把文件放的位置改一下!把这文件放到你的虚拟目录下去试试

规范的写法应当是:
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
表示在服务器端创建

OpenTextFile的方法,其格式是:object.OpenTextFile(filename[, iomode[, create[, format]]])
参数
object
必选项。object 应为 FileSystemObject 的名称。
filename
必选项。指明要打开文件的字符串表达式。
iomode
可选项。可以是三个常数之一:ForReading 、 ForWriting 或 ForAppending 。
create
可选项。Boolean 值,指明当指定的 filename 不存在时是否创建新文件。如果创建新文件则值为 True ,如果不创建则为 False 。如果忽略,则不创建新文件。
format
可选项。使用三态值中的一个来指明打开文件的格式。如果忽略,那么文件将以 ASCII 格式打开。
0表示False ,1表示True

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧