Directive to Not Process Included Script?

B

Bill

I've got a file in an application that is included in many, many files of an
application, like this:

<!--#INCLUDE FILE="inc_file.asp" -->

I need an instruction I can included at the beginning of inc_file.asp so
that it will not process if I decide to turn it off. I know I can just
replace it with a blank file, but I'd like something more flexible.

I'm assuming that Response.End will end the entire script, and not just the
included file.
 
R

Ray Costanzo [MVP]

Open the file, dump all the code into a subroutine, and then use logic like
this:

'inc_file.asp
Call whatever() ''comment out this line to disable execution of code

Sub whatever()
''all of your existing code
End Sub

Ray at home
 
I

io

G'day Bill,

Perhaps the easiest way to do it is just to remove # character in front of
INCLUDE directive. When you need the file back place # back there

Cheers
 
D

Dave Anderson

io said:
Perhaps the easiest way to do it is just to remove # character in
front of INCLUDE directive. When you need the file back place # back
there

Easy, but possibly not desired. Removing the # ensures that you will send
the directive to the client as an HTML comment.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Bill wrote on 30 dec 2004 in microsoft.public.inetserver.asp.general:
I've got a file in an application that is included in many, many files
of an application, like this:

<!--#INCLUDE FILE="inc_file.asp" -->

I need an instruction I can included at the beginning of inc_file.asp
so that it will not process if I decide to turn it off. I know I can
just replace it with a blank file, but I'd like something more
flexible.

I'm assuming that Response.End will end the entire script, and not
just the included file.

Change:

<% ' %><!--#INCLUDE FILE="inc_file.asp" --><% ' %>

to:

<% ' % ><!--#INCLUDE FILE="inc_file.asp" --><% ' %>
 
B

Bill

io said:
G'day Bill,

Perhaps the easiest way to do it is just to remove # character in front of
INCLUDE directive. When you need the file back place # back there

It's in many, MANY files. What you suggest means I'd have to edit every
single on of those files every time I want to turn the script on & off. So,
what you suggest is kind of sloppy from a structured programming
perspective.
 
B

Bill

Makes lots of sense, Ray, thanks!!!



Ray Costanzo said:
Open the file, dump all the code into a subroutine, and then use logic like
this:

'inc_file.asp
Call whatever() ''comment out this line to disable execution of code

Sub whatever()
''all of your existing code
End Sub

Ray at home
 
I

io

Bill said:
It's in many, MANY files. What you suggest means I'd have to edit every
single on of those files every time I want to turn the script on & off. So,
what you suggest is kind of sloppy from a structured programming
perspective.

You cannot avoid modifying your ASP anyway, so its your preference how you
do it - modyfying entries in a single ASP file or commenting and
un-commenting equal number of lines but all in separate files. If the latter
looks less sloppy to you - good luck
 
D

Don Grover

In the inc file do a
If Session("bInclude") ="use" Then
My inc file code here
End If

Then on the initial startup page set the session variable, that shouldby
pass code by only setting one page.

Regards
Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top