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

Hello.

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.

rudyflyerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmelikaCommented:
Rudy,

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
Server.Execute(Path)
%>

Good luck!
JM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rudyflyerAuthor Commented:
UGH.  I was forgetting the filename.  Thank you for pointing that out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.