+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: 500 Internal Server Error when code is in include file

  1. #1
    Barn Newbie vconfused is an unknown quantity at this point vconfused's Avatar
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    3

    500 Internal Server Error when code is in include file

    On my own dev server, it works fine, but on a hosted server I am getting a 500 Internal Server error. Maybe there is a better way to do this.

    I need some common asp code for multiple pages. If I use <!--#include file="common.asp"--> and in the .asp file just have
    Code:
    <%
    Dim strTest
    %>
    
    then I get an error. If I remove the <% and %> then no error, but of course the code is just returned (in this case "Dim strTest"). The main page is also a .asp file.

    Using .inc instead of .asp doesn't make a difference. It was suggestetd to use .asp for the include file so that the script cannot be returned to the visitor if they type in the file name somehow.

    Any ideas?

    Thanks!!

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    If using Internet Explorer, go to Tools -> Internet Options -> Advanced and then uncheck the "Show friendly HTTP errors" under the "Browsing" category.

    Run the page again. Do you see any specific error messages?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Newbie vconfused is an unknown quantity at this point vconfused's Avatar
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    3

    Sorry, I should have mentioned that I have that option turned off. All browsers are returning "Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

    More information about this error may be available in the server error log."

  4. #4
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Could you post some more of your code? From the main .asp page around where you have the include.

  5. #5
    Barn Newbie vconfused is an unknown quantity at this point vconfused's Avatar
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    3

    Certainly. I have:
    Code:
    <%@ Language="VBScript" %> 
    <% OPTION EXPLICIT
    	Dim bolVar
    	bolVar = False
    %>
    <!--#include file="common.asp"-->
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    
    In the common.asp file:
    [code]
    <%
    Dim strVar
    %>

    If I remove the <% and %> in the common.asp then the "Dim strVar" is returned as plain text to the web page, but at least no error.

    Thanks!

  6. #6
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Try closing the asp delimiter '%>' after option explicit and the reopening it for your variable declarations.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #7
    Barn Newbie vconfused is an unknown quantity at this point vconfused's Avatar
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    3

    Unfortunately, same result.

    I can move the include into the <% and %> of main.asp and then not get an error but then I cannot call functions in the included file from the main file. i.e.:

    Code:
    <% OPTION EXPLICIT %>
    
    <% Dim bolVar
    bolVar= False
    <!--#include file="common.asp"-->
    %>
    
    I don't have access to the IIS Manager, but I don't see how a setting could be causing this problem (IIS 6).

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    What if you change it to #include virtual instead of #include file? And are you sure the path is correct?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #9
    Barn Newbie vconfused is an unknown quantity at this point vconfused's Avatar
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    3

    Interesting, unfortunately virtual returned the same thing.

    The path is correct because if I open the included file and remove the <% and %> from the beginning and end, then the code within is returned as plain text when I view the main file.

  10. #10
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Is the code you posted above the entire contents of common.asp? If not can you post it?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Throw HTTP Status Code error
    By richyrich in forum .NET Development
    Replies: 46
    Last Post: December 2nd, 2009, 06:35 PM
  2. Server Error in '/.Net' Application
    By guddu in forum .NET Development
    Replies: 3
    Last Post: August 28th, 2009, 08:28 AM
  3. Cannot find server error
    By richyrich in forum .NET Development
    Replies: 6
    Last Post: November 25th, 2008, 01:28 PM
  4. Server Side Includes .stm file error
    By peebman2000 in forum HTML & CSS Help
    Replies: 6
    Last Post: August 4th, 2008, 11:29 AM
  5. Error Type:Active Server Pages, ASP 0113 (0x80004005)
    By guddu in forum ASP Development
    Replies: 20
    Last Post: July 11th, 2008, 10:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO