2015-10-27 61 views
1

我在一個平臺上的localhost工作。 流程是:無法訪問我的服務器中的網站

  1. 的login.asp插入我的登錄信息(用戶名+密碼)

中的login.asp我有這個

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 
%> 

爲什麼在本地主機I運行良好,但它不是服務器?

多了一個片段,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> 

回答

1

你的描述是標準的ASP錯誤信息,所以用戶不會獲得有關在生產服務器上的錯誤信息的錯誤。

雖然這是所需的行爲,但您必須啓用錯誤輸出,以便您可以看到發生了什麼問題。

在您的服務器上的IIS設置中,選擇ASP,打開「調試屬性」並啓用「向瀏覽器發送錯誤」選項。

更詳細的信息herehere

這樣,您應該可以獲得更多關於生產設置中真正失敗的信息。

+0

謝謝我馬上就試試 – KikoFHM

+0

錯誤是 'ADODB.Connection error'800a0e7a' 提供程序找不到。它可能沒有正確安裝。 /Question/common/_db.asp,線11' 和db.asp '<% 昏暗康恩 集康恩=的Server.CreateObject( 「ADODB.Connection」) 昏暗的ConnectionString %> <! - #include文件= 「DB.INC」 - > <% 的ConnectionString = 「PROVIDER = MICROSOFT.JET.OLEDB.4.0; DATA SOURCE =」 &DBPATH Conn.Open的ConnectionString 子CloseConn \t Conn.Close \t Set Conn = Nothing End Sub %' 和db.inc '<%Dim dbPath:dbPath =「\\ server.domain \ db \ db.mdb」%>' – KikoFHM

+1

好吧,看來您應該安裝數據庫提供程序驅動程序。 – gpinkas

相關問題