Server.Execute - How do I call a dynamic filename?

Posted on 2004-11-29
Last Modified: 2012-06-27

I am trying to include a .asp file into another .asp file.  I am using Server.Execute and I am using the following code:

Server.Execute(Request.QueryString("company") & "/" & dept & "/")

You can see that I am trying to include a file based on the variables passed via the URL.  But I am receiving a "The call to Server.Execute failed while loading the page." error.  

What am I doing wrong?  Is Server.Execute not the best method?  If now, what alternative should I use?

Thanks in advance.

Question by:rudyflyer
    LVL 9

    Accepted Solution


    I don't see a filename at the end of the URL.  Is that a typo or you missed to type it?  Also I'd put the Path in its own variable and then call it with the server.execute.  Do the following:

    Path = Request.QueryString("company") & "/" & dept & "/" & filename

    Good luck!

    Author Comment

    UGH.  I was forgetting the filename.  Thank you for pointing that out.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now