Daniel Nordh
Daniel Nordh

Reputation: 390

Server.Execute with a fixed path

I am trying to implement server.execute() via an include from a virtual functions library (<!-- #include virtual="lib/functions.asp"-->) that I can call on from any subfolder in the system. I am trying to implement a new function that should exist on all pages in our system, and it would be virtually unfeasible to go in and add it manually to every single page. And I need it to be implemented in such a way that it does not interfere with the code on any page which is why I am doing it as a server.execute() in a virtual lib that I know already exists everywhere in the system.

For example:

'location of routine.asp = https://example.com/admin/routine/routine.asp

Server.Execute("routine/routine.asp")
'Will work if I add the virtual lib from an ASP-page in the admin subfolder, but not if I call it from another subfolder

Server.Execute("https://example.com/admin/routine/routine.asp")
'Does not work, because server.execute can't handle that kind of fixed path

The documentation clearly states that colons and double-slashes are not allowed, but I can't figure out how I can make sure the execution of the file happens no matter where in the system it's called from.

Question: How can I make server.execute(path)'s path handle a fixed path, or change the path dynamically to make sure I can always target the file correctly?

Upvotes: 2

Views: 148

Answers (1)

user692942
user692942

Reputation: 16672

If you want to use an absolute path make sure you are using an absolute path (full path from the root).

Think you simply need to specify the absolute path explicitly;

Server.Execute("/admin/routine/routine.asp")

Upvotes: 2

Related Questions