Include file question

Q

qaz

I run a web site on both a testing server and a "production" server. I
noticed that references to the include file do not work on the testing
server but they do work on the production server. I have to change all
references like this:

<!--#INCLUDE VIRTUAL="include/conndb.asp"-->

to references like this:

<!--#INCLUDE FILE="c:/inetpub/wwwroot/ms/include/conndb.asp"-->

To get the system to work on the testing server.

I think that this must be an IIS question. I am guessing that I have IIS
configured differently on the testing and production servers. What do I
need to change to get the testing server to correctly read the VIRTUAL file
path?

Thanks
 
A

Aaron [SQL Server MVP]

Why don't you change the testing server's virtual folder structure to match
production. You should never use hard-coded references like c:\ in an
include directive, in my opinion.
 
S

Steven Burn

If it's just something small and simple, I'd just have it check the server
it's running on (i.e. whether it's local or not).

e.g.

<%
strServer = Request.ServerVariables("HTTP_HOST")
Select Case lcase(strServer)
Case "server_name"
%>
<!--#INCLUDE VIRTUAL="include/conndb.asp"-->
<%
Case Else
%>
<!--#INCLUDE FILE="c:/inetpub/wwwroot/ms/include/conndb.asp"-->
<%
End Select
%>

Not exactly very efficient, but it works (and saves time changing the paths
;o))

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
Q

qaz

The file structure is the same.


Aaron said:
Why don't you change the testing server's virtual folder structure to match
production. You should never use hard-coded references like c:\ in an
include directive, in my opinion.
 
S

Steven Burn

I think he meant, why don't you change the prod serv to match the pub serv,
to allow you to use;

<!--#INCLUDE VIRTUAL="include/conndb.asp"-->

..... on both of them?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
J

Joker

I bet the problem is that the folder c:\inetpub\wwwroot\ms\include is
not the include folder in the root of the web on the production server
like it is on the testing server.

I think I simplified it enough for you to get it after being told twice
before.
I run a web site on both a testing server and a "production" server. I
noticed that references to the include file do not work on the testing
server but they do work on the production server. I have to change all
references like this:

<!--#INCLUDE VIRTUAL="include/conndb.asp"-->

to references like this:

<!--#INCLUDE FILE="c:/inetpub/wwwroot/ms/include/conndb.asp"-->

To get the system to work on the testing server.

I think that this must be an IIS question. I am guessing that I have IIS
configured differently on the testing and production servers. What do I
need to change to get the testing server to correctly read the VIRTUAL file
path?

Thanks

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

If it’s not worth posting you should have done a search on
http://www.google.com/ http://www.google.com/grphp?hl=en&tab=wg&q= or
http://news.google.com/froogle?hl=en&tab=nf&ned=us&q= before wasting our
time.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top