Hi, good programmer but complete noob to ASP/VBscript here, with what must be a painfully obvious noob question...

If I define a function (using sample code from here on devx.com):

<%
function WriteToFile(FileName, Contents, Append)
...
end function
%>

inline in any of several .asp files, it works fine. But if I define the exact same function inside a separate .asp include file and include the file in those original .asp files, I get a syntax error:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/fsglobals.asp, line 7

function WriteToFile(FileName, Contents, Append)
^

Why? Searching the web I find plenty of sites talking about the benefits of defining ASP functions inside include files, but no amount of searching on this forum or on the web has turned up a useful example or a hint as to why this isn't working as expected.

Thanks hugely for any help.