Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8812487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:37:03+00:00 2026-06-14T03:37:03+00:00

I have a global include.asp file which contains this code: if SomeCondition then Response.Clear

  • 0

I have a global include.asp file which contains this code:

if SomeCondition then
    Response.Clear
    Response.Status = "404 Not Found"
    Server.Execute "/error404.asp"
    Respnse.End
end if

Two other files, content.asp and error404.asp #include this file.

The content file sets SomeCondition to true causing the error page to Server.Execute. However, that same condition will be true inside error page. This creates an infinite loop and I end up with the following error:

Server object error 'ASP 0227 : 80004005'
Server.Execute Failed
/include.asp, line 1111
The call to Server.Execute failed

How can I avoid the infinite loop? I had these workarounds in mind:

A

if SomeCondition then
    if GetExecutedFileNameSomehow() <> "error404.asp" then
       ' ...
    end if
end if

But I cannot seem to get the name of error file through code (I have looked inside server variables, all point variables refer to the calling file i.e. content).

B

Use a shared variable e.g. set BeingExecuted = true in content file and check it inside error file but the problem with Server.Execute is that the executed script cannot access calling file’s variables.

Please advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:37:04+00:00Added an answer on June 14, 2026 at 3:37 am

    You are correct, due to the nature of Server.Execute, the script being called does not know its real origin and I didn’t find any way to find it.

    That said, I fear that you’ll have to resort to ugly work arounds, most reliable I can think of is using a Session variable as a “shared variable”.

    In include.asp have such code:

    strFileToExecute = "/error404.asp"
    If (Session("currently_executing")<>strFileToExecute) And (SomeCondition) Then
        Response.Clear
        Response.Status = "404 Not Found"
        Session("currently_executing") = strFileToExecute
        Server.Execute strFileToExecute
        Session("currently_executing") = ""
        Response.End
    End If
    

    The logic is that the Session variable is set right before calling the Execute method. this way when error404.asp is executed and including the same code again, the value of the Session variable will be set and you know to abort the operation thus avoid the endless loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a global static variable x like in this code #include <stdio.h>
I have a global js file which has an ajax script. which is included
I have global static variables in a C library, which generate exceptions in a
In Actionscript you can have global variables like this: var number : Number =
Can Dynamic libraries have global, local and static variables in linux? If yes, then
In classic ASP (which I am forced to use), I have a few factory
I have a classic ASP page, which includes a server side in the section
I have seen at least two ways to include an external log4net config file
I have to include a (managed) C++/CLI component in one of my ASP.NET projects,
I am trying to upload a file with ASP.NET MVC. The following code work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.