2013-10-14 3 views
0

파일 연결을 포함하는 경우 :ASP 클래식 - 오류가 내가 좋아하는 같은 폴더에 두 개의 파일이

<% 
    'declare the variables 
    Dim Connection 
    Dim ConnString 

    'define the connection string, specify database driver 
    ConnString="DRIVER={SQL Server};SERVER=myServername;UID=myUsername;" & _ 
       "PWD=myPassword;DATABASE=myDatabasename" 

    'create an instance of the ADO connection and recordset objects 
    Set Connection = Server.CreateObject("ADODB.Connection") 

    'Open the connection to the database 
    Connection.Open ConnString 
%> 

및 default.asp와 다음이 포함됩니다 :

Example 
|-connect.asp 
|-default.asp 

대로 Connect.asp을 포함

<!-- #include virtual="connect.asp" --> 
<% 
Dim Recordset 
Set Recordset = Server.CreateObject("ADODB.Recordset") 
%> 

하지만 localhost/example을 실행하면 오류가 발생합니다.

An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error.

include 파일을 사용하지 않고 하나의 파일에 모두 쓰면 작동합니다.

어떻게이 오류를 해결할 수 있습니까?

+1

서버에 액세스 할 수 있으면이 페이지에서 유용한 오류 메시지를 얻을 수 있습니다. http://www.chestysoft.com/asp-error-messages.asp – John

+0

IE에서 친숙한 오류 메시지를 해제하고 서버가 자세한 오류 메시지를 보내 더 의미있는 오류 메시지를 얻을 수 있습니다. 또는 오류를 코드에 기록하고 세부 오류 메시지를 어딘가에 기록하십시오. 특정 오류를 알면 더 의미있는 대답을 얻을 수 있습니다. – AnonJr

답변

1

이 같은 시도 : 나는 이전 앱 유사한 문제로 실행

<!--#include file="connect.asp" --> 
1

. 스크립트의 절대 경로를 제공해야했습니다.

스크립트는 최상위 레벨

에있다 그것은 또는을 제외하고 내가 코멘트에 언급 한 것과

1

"포함"와 같은 또 다른 폴더에 있다면, 당신의 형식은 문이 꺼져 포함 . 가상 포함 할 거라면

, 그것은 다음과 같아야합니다

<!-- #include virtual="/connect.asp" --> 
<% 
Dim Recordset 
Set Recordset = Server.CreateObject("ADODB.Recordset") 
%> 

이 포함 된 파일을 할 거라면, 그것은 다음과 같아야합니다

<!-- #include file="connect.asp" --> 
<% 
Dim Recordset 
Set Recordset = Server.CreateObject("ADODB.Recordset") 
%> 

가상 포함은 가상 디렉터리의 루트 (/)에서 시작하여 거기에 포함됩니다. 파일은 파일을 포함하는 페이지로부터의 상대 경로를 사용합니다.