Last post Jul 07, 2014 11:06 AM by MatDion
Jul 04, 2014 01:39 PM|MatDion|LINK
I simply have to use this code (which works fine) : Server.Execute("includes/_temp.inc")
But want to apply it so it becomes "relative" - so all my pages can refer to this single chunk of code....
(Get a relative path so any page in any folder can include the proper file)
The challenge is i must use this "relative" path while i am in a "IF/Then/Else" statement
A simple include code won't work (seems like server preceeds it as plain HTML) this is why i turned to "Server. Execute"
Any help or contact would be appreciated!
Jul 04, 2014 01:58 PM|PatriceSc|LINK
"ASP Classic" question ? Actually it seems you want an *absolute* path such as /includes/_temp.inc so that it always find the folder Under the root of the web site.. The #include directive does work fine. It depends if you are doing this outside or Inside
a server side code block.
With ASP.NET, you would move away from this model (based on compiled code rather than on source files so your code is callable as soon as this is in scope)
Jul 04, 2014 04:39 PM|MatDion|LINK
Thanks for the answer! It gives me some idea. But I'm doing this outside the server side. How should I be doing it?
Jul 05, 2014 08:32 AM|PatriceSc|LINK
In ASP classic if you use #include inside a server side script block it is included as part of this script block. If included inside HTML markup it is part of the markup.
Waht is the problem you have ? I'm not sure what you mean with "seems like server preceeds it as plain HTML". IMO rather than just trying something else because #include doesn't seems to work it's best to understand the exact problem so that you can fix
it as needed. If you have some content in addition to the #include it has to come from somewhere.
Hopefully this an app you have to support. If you just begin with this, using ASP.NET rather than ASP classic will be better.
Jul 07, 2014 11:06 AM|MatDion|LINK
Thank you for your help. Did a script directly on top of the page. It works perfect! Thanks!!!