此代码打开XML文件,除非我解除强制登录的代码。然后我得到:
"错误3709:连接不能用于执行此操作。在这种情况下,它是关闭的或无效的。"
为什么我只能匿名打开?
<%Option Explicit%>
<%Response.Buffer=True%>
<%Server.ScriptTimeOut=120%>
<!DOCTYPE html>
<!--METADATA
TYPE="TypeLib"
NAME="Microsoft ActiveX Data Objects 2.8 Library"
UUID="{2A75196C-D9EB-4129-B803-931327F72D5C}"
VERSION="2.8"
-->
<%
Dim sUserName, rsXML
Const LoadsDB="\\fs1\FileCache\EZL_GridLoads.xml"
'If sUserName="" Then
' ' Force login if we are anonymous
' If Request.ServerVariables("LOGON_USER") = "" Then
' Response.Status = "401 Access Denied"
' Response.End
' End If
'End If
Response.Write "User=" & Request.ServerVariables("LOGON_USER") & "<br/>"
On Error Resume Next
Set rsXML=Server.CreateObject("ADODB.Recordset")
rsXML.Open LoadsDB,,,,adCmdText
if err.number then
response.write "Error " & Err.Number & ":" & Err.Description & "<br/>"
response.write "Opening XML file"
response.end
else
Response.Write "XML successfully opened!<br/>"
Response.Write rsXML.RecordCount & " Records read.<br/>"
rsXML.Close
end if
Set rsXML=Nothing
%>