tags:

views:

789

answers:

1

the following code should show either the port or servername not both

i always get both no matter what ?

  <!--#if expr="${SERVER_PORT} = 80" -->
  <!--#echo var="SERVER_PORT"-->
  <!--#else -->
  <!--#echo var="SERVER_NAME"-->
  <!--#endif -->

i have also tried the follwoing with no joy either !!

  <!--#if expr="${SERVER_PORT} = '80'" -->
  <!--#if expr="${SERVER_PORT} = /80/" -->

i just cannot get the condition to resolve

thanks in advance

A: 

If you're using IIS 6 check that Server Side Includes are permitted:

  1. Launch IIS MMC
  2. Expand Tree and select Web Service Extensions
  3. Check that Server Side Includes are Allowed

If they are, then check that the SSI Script Maps are enabled in the web site properties:

  1. Launch IIS MMC
  2. Right Click and Properties on Site
  3. Select Home Directory Tab
  4. Click Configuration
  5. Verify that the extensions .shtm, shtml and .stm are mapped to C:\WINDOWS\system32\inetsrv\ssinc.dll and that the verbs are set to GET and POST.

Updated:

IIS doesn't support the #if/#else/#endif construct or #set. IIS 6.0's Server Side Include directives are documented here:

IIS Server-Side Include Directives (MSDN Library)

These are for all intents and purposes the same as those used in IIS 5.1.

The directives you're trying to use are supported on Apache, though your should check with your hoster/admin to make sure they're enabled. For more info see:

Apache Tutorial: Introduction to Server Side Includes

Kev
hi, yes all that is set, and to make it more complex certain commands are working so... <!--#echo var="REMOTE_ADDR" --> work fine and deplays 127.0.0.1 so it appears only certain commands do not work also the following doesnt work <!--#set var="title" value="test variable" --> <!--#echo var="title" --> this results in Variable 'title' cannot be found thanks
steve
Thanks. oh well thats anwsers that !!!many thanks Kev.
steve
*** this page that im developing, utimately will be served from Apache, i am presuming that these commands will work when not served from iis ?
steve