
| email this FAQ to a colleague
Q: Is there a way to create functions in seperate files, and have one active server script call the functions? A: Not that I've found, no, and this is one of the most obvious gaps in ASP 3.0 from a software development point of view. There are only two ways to manage code sharing under ASP; include files, and server-side components. Include files work like this: you dump your shared functions in an .INC file, and use an inline include to pull it into your source file of choice: <!--#INCLUDE FILE="foo.inc"--> Server-side components are well-discussed in the ASP documentation; you write your own ActiveX object (using Java, C++, Basic or COBOL), use Server.CreateObject() to instantiate it, and manipulate its properties and call its methods like you would (say) the Ad Rotator or an ADO
RecordSet. AFAIK, there are no way to call functions in other objects from one object. If anyone finds a way, please tell me. Include files are unwieldy and difficult to protect, and deploying new revisions of server-side components requires stopping and restarting the web server. Shared script functions would be an extremely useful half-way point. - Garth T Kidd |