We have an application that has been running on IIS4 and IIS5 for
quite some time, without problem We're now migrating to IIS6
(windows/2003), and have run into a what might be a Javascipt
problem/question, or might be an IIS issue...

The snippet of code in question is:

<script language="JavaScript"><!--
document.write("<script src='/fp/"+includename+"'></script>");
// -->></script>

The included filename is a variable, and does not have a .js
extension. It points to a filename among several thousand files. The
included files ARE javascript files, and contain nothing but
javascript.

This code works fine in IIS4 and IIS5. But when moving to IIS6, the
<script> statement is ignored (because the includename does not end
with .js). If (as a test), I do add a .js on the end of the
includename in the script statement (and create a matching include.js
file), then things work fine.

Our problem is we cannot rename the thousands of files to .js
extensions (they are produced and used by other processes, and the
filename changes would mean more changes in these systems).

I've tried specifying the language, and the type, in the script
statement, but it does not make a difference:

<script language="JavaScript"><!--
document.write("<script language='JavaScript' type='text/javascript'
src='/fp/"+includename+"'></script>");
// -->></script>

It still ignores the <script> statement.

I'm not sure if this is an IIS6 issue, or a Javascript issue. Is
there some way to tell IIS6 to accept the included filename in the SRC
statement as Javascript (as worked in IIS4/IIS5), knowing that the
files do not end in .js?

Thanks for your thoughts.

Re: Javascript document write not working after iis5 to iis6 move by Ken

Ken
Tue Jun 29 23:33:09 CDT 2004

Hi,

http://support.microsoft.com/?id=326965
IIS 6.0 Does Not Serve Unknown MIME Types

Cheers
Ken


"Kevin Potter" <krpotter@co.douglas.or.us> wrote in message
news:64f69747.0406292028.3599ad37@posting.google.com...
: We have an application that has been running on IIS4 and IIS5 for
: quite some time, without problem We're now migrating to IIS6
: (windows/2003), and have run into a what might be a Javascipt
: problem/question, or might be an IIS issue...
:
: The snippet of code in question is:
:
: <script language="JavaScript"><!--
: document.write("<script src='/fp/"+includename+"'></script>");
: // -->></script>
:
: The included filename is a variable, and does not have a .js
: extension. It points to a filename among several thousand files. The
: included files ARE javascript files, and contain nothing but
: javascript.
:
: This code works fine in IIS4 and IIS5. But when moving to IIS6, the
: <script> statement is ignored (because the includename does not end
: with .js). If (as a test), I do add a .js on the end of the
: includename in the script statement (and create a matching include.js
: file), then things work fine.
:
: Our problem is we cannot rename the thousands of files to .js
: extensions (they are produced and used by other processes, and the
: filename changes would mean more changes in these systems).
:
: I've tried specifying the language, and the type, in the script
: statement, but it does not make a difference:
:
: <script language="JavaScript"><!--
: document.write("<script language='JavaScript' type='text/javascript'
: src='/fp/"+includename+"'></script>");
: // -->></script>
:
: It still ignores the <script> statement.
:
: I'm not sure if this is an IIS6 issue, or a Javascript issue. Is
: there some way to tell IIS6 to accept the included filename in the SRC
: statement as Javascript (as worked in IIS4/IIS5), knowing that the
: files do not end in .js?
:
: Thanks for your thoughts.



Re: Javascript document write not working after iis5 to iis6 move by Kristofer

Kristofer
Wed Jun 30 00:04:41 CDT 2004

Hello,

My understanding of your message is that your file(s) does not end with
anything. IIS 6.0 will not serve this unknown "extension", and the
javascript file is therefore not used by the client.

Add the MIME type, and it will work.

--
Regards,
Kristofer Gafvert - IIS MVP
http://www.ilopia.com - When you need help!


"Kevin Potter" <krpotter@co.douglas.or.us> wrote in message
news:64f69747.0406292028.3599ad37@posting.google.com...
> We have an application that has been running on IIS4 and IIS5 for
> quite some time, without problem We're now migrating to IIS6
> (windows/2003), and have run into a what might be a Javascipt
> problem/question, or might be an IIS issue...
>
> The snippet of code in question is:
>
> <script language="JavaScript"><!--
> document.write("<script src='/fp/"+includename+"'></script>");
> // -->></script>
>
> The included filename is a variable, and does not have a .js
> extension. It points to a filename among several thousand files. The
> included files ARE javascript files, and contain nothing but
> javascript.
>
> This code works fine in IIS4 and IIS5. But when moving to IIS6, the
> <script> statement is ignored (because the includename does not end
> with .js). If (as a test), I do add a .js on the end of the
> includename in the script statement (and create a matching include.js
> file), then things work fine.
>
> Our problem is we cannot rename the thousands of files to .js
> extensions (they are produced and used by other processes, and the
> filename changes would mean more changes in these systems).
>
> I've tried specifying the language, and the type, in the script
> statement, but it does not make a difference:
>
> <script language="JavaScript"><!--
> document.write("<script language='JavaScript' type='text/javascript'
> src='/fp/"+includename+"'></script>");
> // -->></script>
>
> It still ignores the <script> statement.
>
> I'm not sure if this is an IIS6 issue, or a Javascript issue. Is
> there some way to tell IIS6 to accept the included filename in the SRC
> statement as Javascript (as worked in IIS4/IIS5), knowing that the
> files do not end in .js?
>
> Thanks for your thoughts.



Re: Javascript document write not working after iis5 to iis6 move by David

David
Wed Jun 30 04:56:26 CDT 2004

Here is what's going on.

When the browser processes your <script> injection, it is going to cause it
to make an additional HTTP request to the server for /fp/something

IIS processes this request like any other (the browser is expecting a
file-download so that it can interpret the script file on the client).
Problem here is that your web pages require resources with "no extensions"
to be downloadable, and that is not enabled by default. IIS6 does not allow
unknown MIME Type resources to be served, and "extension-less" resources
belong in this unknown category. So to fix this, you need to add a MIME
Type for the "extension-less" extension.

And actually, there is a bug (fixed in WS03 SP1) in that you currently
cannot define a MIME Type for an extension-less resource. Thus, the only
solution (very hacky) is to create a MIME Type for .* (i.e. all extensions)
to make it downloadable.

If these extensionless resources are only in the /fp vdir, then I suggest
setting the MIME Type of .* for only the /fp vdir (so you don't screw up
other applications with a global setting). This should allow those
resources to be downloaded, and you can move forward with your application
migration.

The security feature of only allowing resources with defined MIME Types to
be downloadable is one of many security changes made in IIS6. This feature
alone would prevent people from somehow tricking IIS6 into serving .ASP
files without processing them (to steal DB connection username/password, for
example). ASP files do not have a defined MIME Type, thus IIS6 won't allow
files of those extensions to be downloadable.

I highly suggest you read IIS Documentation to get a feel for the dramatic
changes between IIS5 and IIS6, many of them introduced for security reasons.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Kevin Potter" <krpotter@co.douglas.or.us> wrote in message
news:64f69747.0406292028.3599ad37@posting.google.com...
We have an application that has been running on IIS4 and IIS5 for
quite some time, without problem We're now migrating to IIS6
(windows/2003), and have run into a what might be a Javascipt
problem/question, or might be an IIS issue...

The snippet of code in question is:

<script language="JavaScript"><!--
document.write("<script src='/fp/"+includename+"'></script>");
// -->></script>

The included filename is a variable, and does not have a .js
extension. It points to a filename among several thousand files. The
included files ARE javascript files, and contain nothing but
javascript.

This code works fine in IIS4 and IIS5. But when moving to IIS6, the
<script> statement is ignored (because the includename does not end
with .js). If (as a test), I do add a .js on the end of the
includename in the script statement (and create a matching include.js
file), then things work fine.

Our problem is we cannot rename the thousands of files to .js
extensions (they are produced and used by other processes, and the
filename changes would mean more changes in these systems).

I've tried specifying the language, and the type, in the script
statement, but it does not make a difference:

<script language="JavaScript"><!--
document.write("<script language='JavaScript' type='text/javascript'
src='/fp/"+includename+"'></script>");
// -->></script>

It still ignores the <script> statement.

I'm not sure if this is an IIS6 issue, or a Javascript issue. Is
there some way to tell IIS6 to accept the included filename in the SRC
statement as Javascript (as worked in IIS4/IIS5), knowing that the
files do not end in .js?

Thanks for your thoughts.



Re: Javascript document write not working after iis5 to iis6 move by krpotter

krpotter
Wed Jun 30 21:34:44 CDT 2004

"David Wang [Msft]" <someone@online.microsoft.com> wrote in message news:<ea5ZXnoXEHA.1356@TK2MSFTNGP09.phx.gbl>...
> Here is what's going on.
>
> When the browser processes your <script> injection, it is going to cause it
> to make an additional HTTP request to the server for /fp/something
>
> IIS processes this request like any other (the browser is expecting a
> file-download so that it can interpret the script file on the client).
> Problem here is that your web pages require resources with "no extensions"
> to be downloadable, and that is not enabled by default. IIS6 does not allow
> unknown MIME Type resources to be served, and "extension-less" resources
> belong in this unknown category. So to fix this, you need to add a MIME
> Type for the "extension-less" extension.
>
> And actually, there is a bug (fixed in WS03 SP1) in that you currently
> cannot define a MIME Type for an extension-less resource. Thus, the only
> solution (very hacky) is to create a MIME Type for .* (i.e. all extensions)
> to make it downloadable.
>
> If these extensionless resources are only in the /fp vdir, then I suggest
> setting the MIME Type of .* for only the /fp vdir (so you don't screw up
> other applications with a global setting). This should allow those
> resources to be downloaded, and you can move forward with your application
> migration.
>
> The security feature of only allowing resources with defined MIME Types to
> be downloadable is one of many security changes made in IIS6. This feature
> alone would prevent people from somehow tricking IIS6 into serving .ASP
> files without processing them (to steal DB connection username/password, for
> example). ASP files do not have a defined MIME Type, thus IIS6 won't allow
> files of those extensions to be downloadable.
>
> I highly suggest you read IIS Documentation to get a feel for the dramatic
> changes between IIS5 and IIS6, many of them introduced for security reasons.
>
> --
> //David
> IIS
> This posting is provided "AS IS" with no warranties, and confers no rights.
> //
> "

David, thanks for the info on the wildcard MIME type... setting that
just for the directory in question did the trick!