私は、Access DB バックエンドを MySQL に変更する必要がある ASP イントラネット システムを持っています。Access DB は、SQL テーブルと同様の構造で使用されています。同じ構造と命名規則で sql テーブルを作成しました。
ASP Classic アプリケーションには、個々のデータベースに接続するための接続を含むフォルダーがあり、1 つの MySQL データベースにテーブルとしてマージされた 8 つの Access DB があります。
IIS7 でエラー ページをリモートで表示するように設定した後でも、内部エラーが発生するだけで、ブラウザにエラー メッセージを表示する際に問題が発生します。
古い接続:
<%
Dim MM_Employee_STRING
MM_Employee_STRING = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("/employee/DB/employee.mdb")
%>
新しい接続:
<%
Dim MM_Employee_STRING
MM_Employee_STRING = "DRIVER={MySQL ODBC 5.2};SERVER=localhost;UID=root;PWD=password;DATABASE=db")
%>
ログイン ASP コード:
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("UserName"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization="securityLevel"
MM_fldUserRaisedID="RaisedNameID"
MM_redirectLoginSuccess="index.asp"
MM_redirectLoginFailed="error.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Employee_STRING
MM_rsUser.Source = "SELECT LoginUsername, LoginPassword, ID FROM employee_detail"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization & "," & MM_fldUserRaisedID
MM_rsUser.Source = MM_rsUser.Source & " FROM employee_detail WHERE LoginUsername='" & Replace(MM_valUsername,"'","''") &"' AND LoginPassword='" & Replace(Request.Form("Password"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Session("MM_UserID") = MM_rsUser.Fields.Item("ID").Value
Session("MM_RaisedUserID") = MM_rsUser.Fields.Item("RaisedNameID").Value
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
ASP に関する限り、私は一度も触れたことがありません。すべてを ASP.Net に変換して書き直そうとしていますが、何か明らかなことを見逃していないか知りたいです。
ありがとう