我在一个平台上的localhost工作。 流程是:
我有这个
If Session("isAdmin") Then
Response.Redirect "../default.asp"
Else
Response.Redirect "../index.asp"
End If
虽然在服务器上给我错误
处理URL时服务器上发生错误 请联系系统管理员。 如果您是系统管理员,请单击此处以了解有关此错误的更多信息。
网址是/common/_loginme.asp 在此页面中,代码为:
<%
Dim username, password
username = Request.Form("username")
password = Request.Form("password")
If username = "" Then Response.Redirect "login.asp?m=Username é obrigatório."
If password = "" Then Response.Redirect "login.asp?m=Password é obrigatório."
%>
<!-- #include file="_db.asp" -->
<%
sqlLogin = "SELECT TOP 1 id, roleId, name FROM Users WHERE isActive = True AND username = '" & CleanStr(username) & "' AND password = '" & CleanStr(password) & "'"
Set RSlogin = Conn.Execute(sqlLogin)
If RSlogin.EOF Then
Rslogin.Close
Closeconn
Response.Redirect "../login.asp?m=Username ou Password incorretas."
Else
Session("isAdmin") = RSlogin("roleId") = 1
Session("LoginID") = RSlogin("id")
Session("Name") = RSlogin("name")
Rslogin.Close
Closeconn
If Session("isAdmin") Then
Response.Redirect "../default.asp"
Else
Response.Redirect "../index.asp"
End If
End If
RSlogin.Close
Closeconn
%>
<%
Function CleanStr(s)
s = Replace(s,"'","")
s = Replace(s,"<","")
s = Replace(s,">","")
s = Replace(s,";","")
CleanStr = s
End Function
%>
为什么在本地主机中我运行良好但服务器没有?
另外一个片段,web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="Default.asp" />
<add value="Login.asp" />
</files>
</defaultDocument>
</system.webServer>
</configuration>