[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

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.

0
rudyflyer
Asked:
rudyflyer
1 Solution
 
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
 
rudyflyerAuthor Commented:
UGH.  I was forgetting the filename.  Thank you for pointing that out.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now