How do I make asp script into cab file?

Can anyone point me in the right direction? I need to be able to encapsulate asp scripts and put them on my server for use by client sites. This is so that I can keep frequently used code in one place. Easier to manage! But I don't know how to do this. I've seen sites that refer to cab files, but I can't find the correct information on how to implement this. I use straight asp still. Is this a .net only thing? Any help would be much appreciated.
 
.NET uses assemblies in a similar way as you describe here, but I've never seen ASP sites use cab files, nor do I understand why on earth you'd want to do so.

A cab file is nothing more than a file archive format, like zip or tar. It would be far more efficient to have the files available in an uncompressed format so they're directly acessible without extra operations.

There are tools around to compile ASP code to COM DLLs, but they'd require installing on the server afterwards, something which is not likely to happen on a shared server.
 
I think subspace is very right on this.

If you are wanting to share ASP code with one another, I would recommend just calling the ASP txt and putting a note to rename on their servers.
 
Hmmm... sounds good. How do I do this? I have tried to use the include file statement in the local asp code, but when the remote code tries to open a file, it tries to do it on the remote server, not on the intended server. Is this technique similar to what you are talking about?
 
I don't think you can include a server side script from one server to another without severly changing permissions on the remote server and therefore compromising security.

If you just take your .asp file and rename it to whatever.txt you should be able to view it/download it and share it that way.
 
So... I would write a script that would download the source from the remote site whenever a visitor loads the page? Then it would refer to the newly loaded copy to run? This seems like it would take some time to execute since it involves two stages of loading.
 
If you have access to the remote server, then you can configure the permissions on that folder to do what you want. I don't remember the specifics of it, but i know it can be done.
 
I have tried that. The file gets included but it needs to refer to files on the local server. When it does a Server.MapPath it tries to find the file on the remote server. Is there a trick to get the remote asp script to look on the local server for the file it needs?
 
I'm not sure i follow you.

You should be able to use an absolute path to a remote server to a file in a directory on the remote server that has the proper permissions to allow script execution.

If you can explain exactly what it is you are trying to accomplish then maybe i can help further.
 
I have an image processing script that resizes etc. that I want to have one copy of on the "remote server". This script will serve for several web sites that I am designing. The images exist on the websites or the local servers. I seem to be able to do an include that points to the remote script using a http://:www.myspot.com/processimage.asp, but when it tries to do a server.mappath to the local site it can't find it because the mappath looks on the remote server. Does this make sense?
 
In ASP 1.0 + (VBScript) there is a statement named ExecuteGlobal. In theory, you could upload the scripts you'd like to share among several sites on one server, within a NON EXECUTING text file. You would then have your pages on the other sites read this file or if you want to save bandwidth, put a version number on the first line of your script files so that the scripts downloading the file can tell if there are changes or not and would therefore decide whether to cache the script locally or read from a stored copy. You can then either use the Execute GLobal statement to read the text from this cached file so you dont have to INCLUDE it, and voila.

What you would essentially have to do is on each new site, have one COMMON script included in all the files that runs the transfer/cache/read[execute] from cache script.

If you need help on the Execute Global it is part of Microsoft's VBScript V. 5.5 documentation. And for the remote reading, there are several methods you could use.

ExecuteGlobal Statement
Executes one or more specified statements in the global namespace of a script.

ExecuteGlobal statement

The required statement argument is a string expression containing one or more statements for execution. Include multiple statements in the statement argument, using colons or embedded line breaks to separate them.

Remarks
In VBScript, x = y can be interpreted two ways. The first is as an assignment statement, where the value of y is assigned to x. The second interpretation is as an expression that tests if x and y have the same value. If they do, result is True; if they are not, result is False. The ExecuteGlobal statement always uses the first interpretation, whereas the Eval method always uses the second.

Note In Microsoft? JScript?, no confusion exists between assignment and comparison, because the assignment operator (=) is different from the comparison operator.

All statements used with ExecuteGlobal are executed in the script's global namespace. This allows code to be added to the program so that any procedure can access it. For example, a VBScript Class statement can be executed at run time and functions can subsequently create new instances of the class.

Adding procedures and classes at runtime can be useful, but also introduces the possibility of overwriting existing global variable and functions at runtime. Because this can cause significant programming problems, care should be exercised when using the ExecuteGlobal statement. If you don?t need access to a variable or function outside of a procedure, use the Execute statement which will only affect the namespace of the calling function.

The following example illustrates the use of the ExecuteGlobal statement:

Dim X ' Declare X in global scope.
X = "Global" ' Assign global X a value.
Sub Proc1 ' Declare procedure.
Dim X ' Declare X in local scope.
X = "Local" ' Assign local X a value.
' The Execute statement here creates a
' procedure that, when invoked, prints X.
' It print the global X because Proc2
' inherits everything in global scope.
ExecuteGlobal "Sub Proc2: Print X: End Sub"
Print Eval("X") ' Print local X.
Proc2 ' Invoke Proc2 in Global scope resulting
' in "Global" being printed.
End Sub
Proc2 ' This line causes an error since
' Proc2 is unavailable outside Proc1.
Proc1 ' Invoke Proc1.
Execute "Sub Proc2: Print X: End Sub"
Proc2 ' This invocation succeeds because Proc2
' is now available globally.
The following example shows how the ExecuteGlobal statement can be rewritten so you don't have to enclose the entire procedure in the quotation marks:

S = "Sub Proc2" & vbCrLf
S = S & " Print X" & vbCrLf
S = S & "End Sub"
ExecuteGlobal S

This post has given me an idea i could use in my work along the same lines. So i'm now working on something that does what i've described. See if i can actually make the time for it. Let me know if you're interested i'd be glad to share!
 
Thanks very much. This seems like what I've been looking for. I would be interested in how your investigations turn out. I will also post my experiences.
SV :]
 
Sounds to me like what you want is a webservice. You are going to have a REALLY hard time trying to include files across domains, but if you wrap your code in a webservice and expose it's functionality that way, you can access it from anywhere with anything you want.
 
Back
Top