), I get a generi" /> ), I get a generi" /> ), I get a generi"/>

Is there a maximum number of INCLUDES in a Classic ASP page?

358 Views Asked by At

I'm making some updates to a Classic ASP page and I've noticed that when I add a lot of INCLUDES (ie. <!--#INCLUDE FILE="Foo.asp" -->), I get a generic "HTTP/1.1 500 Server Error" displayed in bold on the page.

This is notable in part because I normally get detailed error messages (error, file, line, etc.)

I've checked that none of those INCLUDES have errors. It seems like it has to do with the number of INCLUDES or the fully compiled size of the .asp file.

Is this something I can fix in the ASP settings for IIS?

2

There are 2 best solutions below

5
Michael Kothe-multiNETT On

I never heard about a limitation of includes. but it is possible that your result-page is too large. Did you remove some all includes and put them back step by step?

Alternately i prefer a type of dynamical includes. With my following function you have some advantages: you can include a file dynamically. Your result page will only include the neccascary files. Variables from the main script can be used in the included files. You can put the asp-code into a database.

But this way has one limitation: The whole included file must be written in ASP. So it's not allowed to use <%= date %>. It must be written as response.write date

I'm using a function to include asp-files:

function fGet(getFile)
' source: http://www.aspfaq.de/index.asp?FID=14&ELE=1223
                Set objFileSys = Server.CreateObject("Scripting.FileSystemObject")
    sPfad=Server.MapPath("./")&"\" &getFile

    Set objFile = objFileSys.OpenTextFile(sPfad)
        ' --- read the file
        FileContent = objFile.ReadAll
        objFile.Close
    Set objFile = Nothing
    Set objFileSys = Nothing

     fileContent=replace(fileContent,chr(60)&chr(37),"")
     fileContent=replace(fileContent,chr(37)&chr(62),"")

     Execute(FileContent)


end function
1
user11312624 On

Try <%response.buffer = false%>. It defaults to true in IIS5.0 and later and must be explicitly switched off. It should be the very first line of code beneath the @LANGUAGE directive.

Turning off this buffer will free up resources so you won't hit your maximum. Increasing cache size isn't always feasible on shared hosting which is where you are likely to encounter size limits.