[thelist] External .js and ASP

Joshua Olson joshua at waetech.com
Wed Feb 18 15:58:22 CST 2004


> -----Original Message-----
> From: Scott Dexter
> Sent: Wednesday, February 18, 2004 4:48 PM
>
> My question is, why use Server.Execute when you're not
> executing any code? It seems to me you want to
> /include/ that snippet, not execute it. Pray tell the
> reasoning behind using Server.Execute here?
>
> Maybe wrap your executed page in a Response.Write er
> something?

sgd,

I can answer this one as I've had to do this before.  In ASP there are four
ways to include text from an external file:

1.  Use the file system object to load the file into a variable and then
Response.Write it out.  This works well but requires a chunk of code.

2.  Use an HTTP tool to grab the text via HTTP into a file and then
Response.Write it out.  This is slow and has LOT of limitations.

3.  Use the <!-- #include file="something.txt" --> format... this works
great and is fast, but you cannot programmatically change the file being
included.  You cannot put a variable in the include... it's al hard-coded.

4.  Use Server.Execute.  It's new to IIS5, but is a really cool addition in
that it'll simply add the file to the buffer after parsing it for ASP--just
like cfinclude in CF.  It's actually quite slick.

I'm still believe that Tab needs to check the resulting code in the browser
to see if the HTML page is right (you should see the header stuff with the
script block in there ok).  If the header is well formed, then just check
the path to the JS file.  I'd still put bet that the JS file doesn't exist
in the local folder.  Getting back a 404 when you expect a well formed js
file will cause all sorts of errors in the browser, especially when you try
to call a function that wasn't defined because the js file was never
included in the first place.

Tab, have you looked at the main page's HTML in the browser?  Does the HEAD
portion of the HTML look ok?

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list