Help

J

Jose

Can anyone help?

I try to put all my function in a separate .ASP file
under scriptlib folder but when I call any function
from the such asp file do not work meanwhile
if I put the code inside the working asp works fine

explain:
mytools.asp
<%SCRIPT Language="vbscript"%>
function abc(pParam)
abc = "OK"
end function
function xyz(pParam)
xyz = "NOT OK"
end function


Main ASP File
default.asp (Contains)

<%
<script language="vbscript" scr=scriptlib/mytools.asp">
<font face="Verdana" size=1><%=abc("GO")%>
</font>
</script>
%>


TIA
Jo
 
M

middletree

Don't call in an external asp file with the <Script> tag. That's for
client-side code.

Do it in an include file instead
 
R

Roland Hall

:
: Can anyone help?
:
: I try to put all my function in a separate .ASP file
: under scriptlib folder but when I call any function
: from the such asp file do not work meanwhile
: if I put the code inside the working asp works fine
:
: explain:
: mytools.asp
: <%SCRIPT Language="vbscript"%>
: function abc(pParam)
: abc = "OK"
: end function
: function xyz(pParam)
: xyz = "NOT OK"
: end function
:
:
: Main ASP File
: default.asp (Contains)
:
: <%
: <script language="vbscript" scr=scriptlib/mytools.asp">
: <font face="Verdana" size=1><%=abc("GO")%>
: </font>
: </script>
: %>

Jo...

This is client-side vbscript. You cannot nest the <script> tag. If you
want to call the script via a script tag, then you need to remove that from
the source document. Take out <script language="vbscript"></script> from
mytools.asp.

Another problem you have is syntax.
<% %> or <script runat=server></script>, but not both.

<%<script... is invalid.

Change mytools.asp to:

mytools.asp
<%
function abc(pParam)
abc = "OK"
end function
function xyz(pParam)
xyz = "NOT OK"
end function
%>

Change default.asp to:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include file="scriptlib/mytools.asp"-->
<html>
<head>
</head>
<body>
<font face="Verdana" size=1><%=abc("GO")%></font>
</body>
</html>

Or use .css
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include file="scriptlib/mytools.asp"-->
<html>
<head>
<style type="text/css">
..v1 { font: normal xx-small verdana }
</style>
</head>
<body>
<span class="v1"><%=abc("GO")%></span>
</body>
</html>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
R

Roland Hall

:
: "Jose" wrote:
: : Can anyone help?
: :
: : I try to put all my function in a separate .ASP file
: : under scriptlib folder but when I call any function
: : from the such asp file do not work meanwhile
: : if I put the code inside the working asp works fine
: :
: : explain:
: : mytools.asp
: : <%SCRIPT Language="vbscript"%>
: : function abc(pParam)
: : abc = "OK"
: : end function
: : function xyz(pParam)
: : xyz = "NOT OK"
: : end function
: :
: :
: : Main ASP File
: : default.asp (Contains)
: :
: : <%
: : <script language="vbscript" scr=scriptlib/mytools.asp">
: : <font face="Verdana" size=1><%=abc("GO")%>
: : </font>
: : </script>
: : %>
:
: Jo...
:
: This is client-side vbscript. You cannot nest the <script> tag. If you
: want to call the script via a script tag, then you need to remove that
from
: the source document. Take out <script language="vbscript"></script> from
: mytools.asp.
:
: Another problem you have is syntax.
: <% %> or <script runat=server></script>, but not both.
:
: <%<script... is invalid.
:
: Change mytools.asp to:
:
: mytools.asp
: <%
: function abc(pParam)
: abc = "OK"
: end function
: function xyz(pParam)
: xyz = "NOT OK"
: end function
: %>
:
: Change default.asp to:
:
: <%@ Language=VBScript %>
: <%
: Option Explicit
: Response.Buffer = True
: %>
: <!--#include file="scriptlib/mytools.asp"-->
: <html>
: <head>
: </head>
: <body>
: <font face="Verdana" size=1><%=abc("GO")%></font>
: </body>
: </html>
:
: Or use .css
: <%@ Language=VBScript %>
: <%
: Option Explicit
: Response.Buffer = True
: %>
: <!--#include file="scriptlib/mytools.asp"-->
: <html>
: <head>
: <style type="text/css">
: .v1 { font: normal xx-small verdana }
: </style>
: </head>
: <body>
: <span class="v1"><%=abc("GO")%></span>
: </body>
: </html>

A little more info:

<script language="vbscript">

This is client-size and language on client-side has been deprecated. Use
this instead:
<script type="text/vbscript">

On the server-side, you use this:
<script language="vbscript" runat="server">

ONLY ASP code goes in between here:

<% %>

....unless you wrap the code in a Response.Write("")

<%
Response.Write("<html>" & vbCrLf)
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
J

Josaz

Thanks Much roland,
Maybe you can answer me this question
I wrote a .DLL in VB6 with the company business rule that I like to use
along with my asp project how do I register it in the server in order for me
to see it as a COM+ I understand that some changes need to be done in the
..DLL Code.

TIA
Jo
 
R

Roland Hall

:
: Thanks Much roland,
: Maybe you can answer me this question
: I wrote a .DLL in VB6 with the company business rule that I like to use
: along with my asp project how do I register it in the server in order for
me
: to see it as a COM+ I understand that some changes need to be done in the
: .DLL Code.

Jo...

You register a .dll with regsvr32.
http://www.vb2themax.com/HtmlDoc.asp?Table=Articles&ID=290&Page=3

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
R

Roland Hall

:
: "Josaz" wrote:
: : Thanks Much roland,
: : Maybe you can answer me this question
: : I wrote a .DLL in VB6 with the company business rule that I like to use
: : along with my asp project how do I register it in the server in order
for
: me
: : to see it as a COM+ I understand that some changes need to be done in
the
: : .DLL Code.
:
: Jo...
:
: You register a .dll with regsvr32.
: http://www.vb2themax.com/HtmlDoc.asp?Table=Articles&ID=290&Page=3

An article that may be of benefit:
http://www.15seconds.com/issue/010212.htm

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
J

Josaz

Thank you again roland, so forth I have done so
Register the .DLL in the Server where IIS is hosting
but when I try to call a function from it I get the ASP error

'- This some part of my asp code.
'- Trying to make it call to my .DLL (COM)
<%@Language="vbscript" RUNAT="Server"%>
<%
Set myFunc = CreateObject("MyDll.CLass")
%>
<%=myFunc.This(this)%>
or
<%
Response.write("myFunc.That(this)")
%>
Error page can not be displayed.

Thanks again
 
R

Roland Hall

:
: Thank you again roland, so forth I have done so
: Register the .DLL in the Server where IIS is hosting
: but when I try to call a function from it I get the ASP error
:
: '- This some part of my asp code.
: '- Trying to make it call to my .DLL (COM)
: <%@Language="vbscript" RUNAT="Server"%>
: <%
: Set myFunc = CreateObject("MyDll.CLass")
: %>
: <%=myFunc.This(this)%>
: or
: <%
: Response.write("myFunc.That(this)")
: %>
: Error page can not be displayed.
:
: Thanks again

Aren't you having a problem with this line?
<%@Language="vbscript" RUNAT="Server"%>

Try:
<%@ Language=VBScript %>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top