Search code examples
asp-classicincludeserver-side-includes

In ASP CLASSSIC inclusions are executed before or after the statements?


Let's assume we have a situation like:

if session("lenguage") = "ENG" then

<!--#include file="eng_page.asp"-->

else

<!--#include file="not_eng_page.asp"-->

end if

I would like to understand if the result ASP file will have booth the includes (and then only one of them will be executed) or will have only the one that depends on the session variable.

I mean, may I use it to decrease the weight of page? It could be of help if I know that some snippets of codes are included only if they really deserve it...


Solution

  • Just use Server.Execute:

    If Session("lenguage") = "ENG" Then
        Server.Execute("eng_page.asp") 
    Else  
        Server.Execute("not_eng_page.asp") 
    End If