Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Shared Libraries with ASP / WSH

I'm developing a library of JavaScript functions (could just as easily be VBScript).  Right now, they're in a file called lib.js that can be included in a WSH .wsf file via the SCRIPT tag.

If I convert lib.js file to lib.asp by adding SCRIPT tags within the file itself, I can include lib.asp in other ASP scripts (but then I can no longer use it with WSH).

I hate the thought of manually keeping these two files in sync.  While I could write a short script to add the necessary wrapper around the .js file, that's an ugly hack at best.  How can I combine lib.js & lib.asp into ONE file that can be included from BOTH ASP and WSH?
0
djschaap
Asked:
djschaap
  • 5
  • 4
1 Solution
 
sybeCommented:
i never tried this, but create 2 files for include with asp, with just the tags.

===========
file starttag.inc
===========
<%
===========

===========
file endtag.inc
===========
%>
===========

then in asp include like this:
<!--#include file="starttag.inc"-->
<!--#include file="yourlib.asp"-->
<!--#include file="endtag.inc"-->
0
 
djschaapAuthor Commented:
Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
0
 
sybeCommented:
and what about using the html <script> tag in your asp:

<script scr="yourlib.asp" language="jscript" runat="server"/>

(never tried that either...)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sybeCommented:
no, that sounds weird, it's a client tag, won't work.
0
 
djschaapAuthor Commented:
Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
0
 
sybeCommented:
hmm, after all it's not so bad.

I tried this:

<script runat="server" language="vbscript" src="lib/formfunctions_2.asp"></script>

and removed the <script> tags from the include, and it seems to work...
0
 
djschaapAuthor Commented:
(Please ignore my extra comments -- reload does more than I thought!)
0
 
sybeCommented:
so:....

did it work ?? because i think you got a working answer.
if so, then pls close this question.
0
 
djschaapAuthor Commented:
That worked!  Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now