include file outside web site

include file outside web site

am 16.02.2007 04:00:18 von SteveT

Is it possible to have an include file that resides outside of the web site
parent folder?
For instance, lets say you have several websites under
Inetpub/global/websites/ but the include file is in Inetpub/inc/
I get a file not found error trying file/virtual starting with the root and
even using C:/Inetpub.

Example

Inetpub/global/websites/website1/global.asa

Inside global.asa is the statement

<--Include file="C:/inetpub/inc/functions.inc"-->

Thanks,
Steve

Re: include file outside web site

am 16.02.2007 04:25:25 von Trevor_L.

SteveT wrote:
> Is it possible to have an include file that resides outside of the
> web site parent folder?
> For instance, lets say you have several websites under
> Inetpub/global/websites/ but the include file is in Inetpub/inc/
> I get a file not found error trying file/virtual starting with the
> root and even using C:/Inetpub.
>
> Example
>
> Inetpub/global/websites/website1/global.asa
>
> Inside global.asa is the statement
>
> <--Include file="C:/inetpub/inc/functions.inc"-->
>
> Thanks,
> Steve

Yes, I think so

I have this in my site (see signature)

It is called from guestbook.asp in the parent folder

I assume that you can also navigate up and down the folder structure using
(for example) ../foldername/filename.inc

From Inetpub/global/websites/website1/global.asa, you would have to go up
three (to Inetpub/) then down to inc/.

So I would try:


--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------

Re: include file outside web site

am 16.02.2007 04:47:51 von Dave Anderson

"SteveT" wrote:
> Is it possible to have an include file that resides outside of
> the web site parent folder?

With parent paths enabled, you can go as far as the root of the same drive,
provided you use this type of path:





--
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.

Re: include file outside web site

am 16.02.2007 07:13:11 von SteveT

Thanks for the responses but my problem is that I want to use this as a
generic file but some of the web site folders are at different levels.
So I would have to adjust each global.asa that references the include file
depending on what level the global.asa file is.

I need to refer to it from the root somehow.
When I use <-- include file="C:/inetpub/inc/functions.inc"--> I get file not
found.
Interesting enough ado, filesystem and other objects work fine referring to
the logical path but asp does not seem to for some reason.

Parent paths are enabled.

Thanks,
Steve

Re: include file outside web site

am 16.02.2007 09:35:31 von Mike Brind

"SteveT" wrote in message
news:udNxTGZUHHA.388@TK2MSFTNGP04.phx.gbl...
> Thanks for the responses but my problem is that I want to use this as a
> generic file but some of the web site folders are at different levels.
> So I would have to adjust each global.asa that references the include file
> depending on what level the global.asa file is.
>
> I need to refer to it from the root somehow.
> When I use <-- include file="C:/inetpub/inc/functions.inc"--> I get file
> not
> found.
> Interesting enough ado, filesystem and other objects work fine referring
> to
> the logical path but asp does not seem to for some reason.
>
> Parent paths are enabled.
>

makes implicit use of Server.Mappath to do its magic.
Server.Mappath maps a virtual or relative file path. <% Response.Write
Server.Mappath("C:/inetpub/inc/functions.inc") %> will probably give you
something like this:

C:/InetPub/wwwroot/test/C:/inetpub/inc/functions.inc

- assuming that you are running this script in the "test" directory.

--
Mike Brind

Re: include file outside web site

am 16.02.2007 11:13:01 von Anthony Jones

"SteveT" wrote in message
news:eexTgaXUHHA.488@TK2MSFTNGP06.phx.gbl...
> Is it possible to have an include file that resides outside of the web
site
> parent folder?
> For instance, lets say you have several websites under
> Inetpub/global/websites/ but the include file is in Inetpub/inc/
> I get a file not found error trying file/virtual starting with the root
and
> even using C:/Inetpub.
>
> Example
>
> Inetpub/global/websites/website1/global.asa
>
> Inside global.asa is the statement
>
> <--Include file="C:/inetpub/inc/functions.inc"-->
>
> Thanks,
> Steve


The file attribute of an #include directive can only be a relative path and
enabling parent paths is a security risk.

The solution to this problem is to add virtual folder to the root of each
website that points to the inc folder. (BTW, it's also not a good idea to
use the .inc extension .asp is better)

You then change your include directives on all your pages to:-



Anthony.

Re: include file outside web site

am 16.02.2007 17:31:58 von SteveT

I don't believe you can use <% %> in the global.asa. I have not found a away
to concatenate the file for the include statement.

Thanks,
Steve

"Mike Brind" wrote in message
news:erOw9VaUHHA.4872@TK2MSFTNGP03.phx.gbl...
>
> "SteveT" wrote in message
> news:udNxTGZUHHA.388@TK2MSFTNGP04.phx.gbl...
> > Thanks for the responses but my problem is that I want to use this as a
> > generic file but some of the web site folders are at different levels.
> > So I would have to adjust each global.asa that references the include
file
> > depending on what level the global.asa file is.
> >
> > I need to refer to it from the root somehow.
> > When I use <-- include file="C:/inetpub/inc/functions.inc"--> I get file
> > not
> > found.
> > Interesting enough ado, filesystem and other objects work fine referring
> > to
> > the logical path but asp does not seem to for some reason.
> >
> > Parent paths are enabled.
> >
>
> makes implicit use of Server.Mappath to do its magic.
> Server.Mappath maps a virtual or relative file path. <% Response.Write
> Server.Mappath("C:/inetpub/inc/functions.inc") %> will probably give you
> something like this:
>
> C:/InetPub/wwwroot/test/C:/inetpub/inc/functions.inc
>
> - assuming that you are running this script in the "test" directory.
>
> --
> Mike Brind
>
>

Re: include file outside web site

am 16.02.2007 17:37:01 von SteveT

Thanks for all of the responses.

It's interesting because Parent Paths is selected by default. Also, ado,
filesystem and other objects allow logical paths so I am not sure what MS
was thinking for security issues.

Is there a way to setup a global virtual folder for all web sites? It
appears I have to add it to each one individually.

Thanks,
Steve

"Anthony Jones" wrote in message
news:OOc3LMbUHHA.4076@TK2MSFTNGP05.phx.gbl...
>
> "SteveT" wrote in message
> news:eexTgaXUHHA.488@TK2MSFTNGP06.phx.gbl...
> > Is it possible to have an include file that resides outside of the web
> site
> > parent folder?
> > For instance, lets say you have several websites under
> > Inetpub/global/websites/ but the include file is in Inetpub/inc/
> > I get a file not found error trying file/virtual starting with the root
> and
> > even using C:/Inetpub.
> >
> > Example
> >
> > Inetpub/global/websites/website1/global.asa
> >
> > Inside global.asa is the statement
> >
> > <--Include file="C:/inetpub/inc/functions.inc"-->
> >
> > Thanks,
> > Steve
>
>
> The file attribute of an #include directive can only be a relative path
and
> enabling parent paths is a security risk.
>
> The solution to this problem is to add virtual folder to the root of each
> website that points to the inc folder. (BTW, it's also not a good idea to
> use the .inc extension .asp is better)
>
> You then change your include directives on all your pages to:-
>
>
>
> Anthony.
>
>
>

Re: include file outside web site

am 16.02.2007 18:15:22 von Mike Brind

No you can't. I wasn't referring to your desire to use Global.asa. I was
talking generally.

Mike

"SteveT" wrote in message
news:Oj4%23DgeUHHA.528@TK2MSFTNGP03.phx.gbl...
>I don't believe you can use <% %> in the global.asa. I have not found a
>away
> to concatenate the file for the include statement.
>
> Thanks,
> Steve
>
> "Mike Brind" wrote in message
> news:erOw9VaUHHA.4872@TK2MSFTNGP03.phx.gbl...
>>
>> "SteveT" wrote in message
>> news:udNxTGZUHHA.388@TK2MSFTNGP04.phx.gbl...
>> > Thanks for the responses but my problem is that I want to use this as a
>> > generic file but some of the web site folders are at different levels.
>> > So I would have to adjust each global.asa that references the include
> file
>> > depending on what level the global.asa file is.
>> >
>> > I need to refer to it from the root somehow.
>> > When I use <-- include file="C:/inetpub/inc/functions.inc"--> I get
>> > file
>> > not
>> > found.
>> > Interesting enough ado, filesystem and other objects work fine
>> > referring
>> > to
>> > the logical path but asp does not seem to for some reason.
>> >
>> > Parent paths are enabled.
>> >
>>
>> makes implicit use of Server.Mappath to do its
>> magic.
>> Server.Mappath maps a virtual or relative file path. <% Response.Write
>> Server.Mappath("C:/inetpub/inc/functions.inc") %> will probably give you
>> something like this:
>>
>> C:/InetPub/wwwroot/test/C:/inetpub/inc/functions.inc
>>
>> - assuming that you are running this script in the "test" directory.
>>
>> --
>> Mike Brind
>>
>>
>
>

Re: include file outside web site

am 17.02.2007 17:07:01 von Dave Anderson

"Anthony Jones" wrote:
> (BTW, it's also not a good idea to use the .inc extension
> .asp is better)

That's only true if you don't tell IIS to parse .inc files with asp.dll, a
step that makes the two extensions equals.



--
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.

Re: include file outside web site

am 17.02.2007 17:13:25 von Dave Anderson

"SteveT" wrote:
> It's interesting because Parent Paths is selected by default.

That is because you are on IIS 5. This is not true with IIS 6+:
http://msdn.microsoft.com/library/en-us/iissdk/html/30d46649 -330a-46bc-8d4b-541ed541e3a5.asp



> Is there a way to setup a global virtual folder for all web
> sites? It appears I have to add it to each one individually.

That depends on whether you think it is more work to set each one manually
or to script the metabase.



--
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.

Re: include file outside web site

am 17.02.2007 18:34:19 von SteveT

Actually I am using IIS 6.



"Dave Anderson" wrote in message
news:12teadji0f2k26f@corp.supernews.com...
> "SteveT" wrote:
> > It's interesting because Parent Paths is selected by default.
>
> That is because you are on IIS 5. This is not true with IIS 6+:
>
http://msdn.microsoft.com/library/en-us/iissdk/html/30d46649 -330a-46bc-8d4b-541ed541e3a5.asp
>
>
>
> > Is there a way to setup a global virtual folder for all web
> > sites? It appears I have to add it to each one individually.
>
> That depends on whether you think it is more work to set each one manually
> or to script the metabase.
>
>
>
> --
> 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.
>

Re: include file outside web site

am 17.02.2007 18:47:26 von Anthony Jones

"SteveT" wrote in message
news:eA6D6ieUHHA.2212@TK2MSFTNGP02.phx.gbl...
> Thanks for all of the responses.
>
> It's interesting because Parent Paths is selected by default. Also, ado,
> filesystem and other objects allow logical paths so I am not sure what MS
> was thinking for security issues.
>
> Is there a way to setup a global virtual folder for all web sites? It
> appears I have to add it to each one individually.
>

It's not possible to create a 'global' virtual folder that appears in all
websites. How many sites do you have? We are talking sites not just
applications right?

Re: include file outside web site

am 17.02.2007 19:02:27 von Anthony Jones

"Dave Anderson" wrote in message
news:12tea1jk000av23@corp.supernews.com...
> "Anthony Jones" wrote:
> > (BTW, it's also not a good idea to use the .inc extension
> > .asp is better)
>
> That's only true if you don't tell IIS to parse .inc files with asp.dll, a
> step that makes the two extensions equals.
>

Making an unnecessary change to a servers default configuration is not a
good idea. If you lose the server it's just another tweak you need to
remember to do to when recreating your app.

It's not just though. Most editors I've come across do not recognise .inc as
typically holding ASPs mix of VBScript and HTML syntax. Some will allow you
to specify the .inc as such but that's another tweak you need to do.

Overall it's just a lot less hassle using .asp as the extension and
forgetting about it.

Re: include file outside web site

am 17.02.2007 19:02:41 von SteveT

Right now there are about 10 sites with more to come.
I reorganized my folder structure and using the relative path for now.

Thanks for all of the responses,
Steve



"Anthony Jones" wrote in message
news:uLSjxurUHHA.5108@TK2MSFTNGP06.phx.gbl...
>
> "SteveT" wrote in message
> news:eA6D6ieUHHA.2212@TK2MSFTNGP02.phx.gbl...
> > Thanks for all of the responses.
> >
> > It's interesting because Parent Paths is selected by default. Also, ado,
> > filesystem and other objects allow logical paths so I am not sure what
MS
> > was thinking for security issues.
> >
> > Is there a way to setup a global virtual folder for all web sites? It
> > appears I have to add it to each one individually.
> >
>
> It's not possible to create a 'global' virtual folder that appears in all
> websites. How many sites do you have? We are talking sites not just
> applications right?
>
>

Re: include file outside web site

am 17.02.2007 19:06:25 von SteveT

Yeah, I think we are all getting away from .inc. It was more for
example/clarification.
It is true that editors like Homesite will highlight key words if the file
is .asp which helps coding.

Steve


"Anthony Jones" wrote in message
news:%23GjFK3rUHHA.4276@TK2MSFTNGP02.phx.gbl...
>
> "Dave Anderson" wrote in message
> news:12tea1jk000av23@corp.supernews.com...
> > "Anthony Jones" wrote:
> > > (BTW, it's also not a good idea to use the .inc extension
> > > .asp is better)
> >
> > That's only true if you don't tell IIS to parse .inc files with asp.dll,
a
> > step that makes the two extensions equals.
> >
>
> Making an unnecessary change to a servers default configuration is not a
> good idea. If you lose the server it's just another tweak you need to
> remember to do to when recreating your app.
>
> It's not just though. Most editors I've come across do not recognise .inc
as
> typically holding ASPs mix of VBScript and HTML syntax. Some will allow
you
> to specify the .inc as such but that's another tweak you need to do.
>
> Overall it's just a lot less hassle using .asp as the extension and
> forgetting about it.
>
>
>

Re: include file outside web site

am 18.02.2007 03:49:10 von Dave Anderson

"SteveT" wrote:
>>> It's interesting because Parent Paths is selected by default.
>>
>> That is because you are on IIS 5. This is not true with IIS 6+:
>>
> Actually I am using IIS 6.

In that case, parent paths were DISABLED by default -- at least by the IIS
documentation and by my possibly faulty memory.



--
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.

Re: include file outside web site

am 18.02.2007 04:10:03 von Dave Anderson

"Anthony Jones" wrote:
> Making an unnecessary change to a servers default configuration
> is not a good idea.

I flatly reject that assertion. A custom 404 error page is the simplest
counterexample.

Besides, you still have not demonstrated that it is unnecessary. You don't
know how many .inc files he "needs" to convert to the .asp extension. Nor do
you know if he has to babysit vendor-provided applications that could use
such an extension. Heaven knows my company has purchased its share of
"solutions" at various points in the past.



> If you lose the server it's just another tweak you need to
> remember to do to when recreating your app.

That's what they pay us for. Get used to it.



> Most editors I've come across do not recognise .inc as
> typically holding ASPs mix of VBScript and HTML syntax...

I agree that IDE eye candy (and intellisense) are great reasons to use the
..asp extensions -- although they do little for people like me, since none I
have encountered can be configured to treat include .asp files as JScript --
but that certainly does not make the use of .inc a bad idea.



> Overall it's just a lot less hassle using .asp as the extension
> and forgetting about it.

Now there's something I agree with.


--
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.

Re: include file outside web site

am 18.02.2007 09:54:10 von Anthony Jones

"Dave Anderson" wrote in message
news:12tfgsd2ntga730@corp.supernews.com...
> "Anthony Jones" wrote:
> > Making an unnecessary change to a servers default configuration
> > is not a good idea.
>
> I flatly reject that assertion. A custom 404 error page is the simplest
> counterexample.

In that case your change to the custom errors property would not constitute
an 'unneccessary' change now would it?

>
> Besides, you still have not demonstrated that it is unnecessary.
> You don't know how many .inc files he "needs" to convert to the .asp
extension. Nor do
> you know if he has to babysit vendor-provided applications that could use
> such an extension. Heaven knows my company has purchased its share of
> "solutions" at various points in the past.

My original comment to the OP on the matter was enclosed in parentheses and
prefixed with BTW. I was pointing out that in general .asp is better the
..inc

It was to this point alone you responded:-

>>>That's only true if you don't tell IIS to parse .inc files with asp.dll,
a
>>>step that makes the two extensions equals.

Were you making a general comment here or one specific to the OP's case?

>
>
> > If you lose the server it's just another tweak you need to
> > remember to do to when recreating your app.
>
> That's what they pay us for. Get used to it.
>

There are other people on my team who have that responsibility. I try not
to make their life harder by asking them to make changes that aren't really
necessary. We all get paid by customers to help their business make
progress not to fiddle around with servers.


>
>
> > Most editors I've come across do not recognise .inc as
> > typically holding ASPs mix of VBScript and HTML syntax...
>
> I agree that IDE eye candy

That term 'candy' demigrates the importance of syntax highlighting.
However, silly but time consuming bugs can be avoided when the such tools
help to highlight them.

> (and intellisense) are great reasons to use the
> .asp extensions -- although they do little for people like me, since none
I
> have encountered can be configured to treat include .asp files as
JScript --

Yeah I can see that being annoying.

> but that certainly does not make the use of .inc a bad idea.

On it's own probably not.

>
>
>
> > Overall it's just a lot less hassle using .asp as the extension
> > and forgetting about it.
>
> Now there's something I agree with.
>
>
> --
> 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.
>

Re: include file outside web site

am 18.02.2007 17:43:41 von Dave Anderson

"Anthony Jones" wrote:
> It was to this point alone you responded:-
>
>>>> That's only true if you don't tell IIS to parse .inc files
>>>> with asp.dll, a step that makes the two extensions equals.
>
> Were you making a general comment here or one specific to the
> OP's case?

Neither. I specifically addressed your point. You wrote:

"(BTW, it's also not a good idea to use the .inc extension
.asp is better)"

Simply saying that .asp is better imparts no information to the OP. As I
already said, we do not know his lagacy support scenario, He could have 1000
..inc files out there, and all you told him was ".asp is better". A
reasonable response on his part would be to ask if his apps work, and with
the affirmative response, promptly shrug it off.

And BTW, with a default IIS 6 configuration, there is no .inc security hole,
so there is no "server maintenance" needed.



>> I agree that IDE eye candy
>
> That term 'candy' demigrates the importance of syntax highlighting.
> However, silly but time consuming bugs can be avoided when the such
> tools help to highlight them.
>
>> (and intellisense) are great reasons to use the .asp extensions
>> -- although they do little for people like me, since none I
>> have encountered can be configured to treat include .asp files
>> as JScript --
>
> Yeah I can see that being annoying.

"Annoying" denigrates the importance of syntax highlighting...



--
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.