Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Classic asp include

I am trying to separate some asp logic out into a separate page. For now, I am trying to call a simple function.

Here is the simple index page that I am using

<html>
<head>
<title>Calling a webservice from classic ASP</title>
</head>
<body>
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
 %>
  <!--#include file="aspFunctions.asp"-->
  <%
  doStuff()
End If
%>
<FORM method=POST name="form1" ID="Form1">
ID:
<INPUT type="text" name="corpId" ID="id" value="050893">
<BR><BR>
<INPUT type="submit" value="GO" name="submit1" ID="Submit1" >
</form>
</body>
</html>

Here is aspfunctions.asp

sub doStuff()
    Response.Write("In Do Stuff")
end sub

When i hit the submit button on my form i get the below sub doStuff() Response.Write("In Do Stuff") end sub

Microsoft VBScript runtime error '800a000d'

Does anyone have any idea what i could be doing wrong?

Any help is greatly appreciated

Thanks Damien Type mismatch: 'doStuff'

/uat/damien/index.asp, line 15

like image 747
Damien Avatar asked Dec 06 '25 06:12

Damien


2 Answers

You must have the asp functions inside the <% %> tag.

like image 102
Gautam Jain Avatar answered Dec 08 '25 16:12

Gautam Jain


aspfunctions.asp should be inside tags so the asp is "executed", e.g.

aspfunctions.asp file:

<%
sub doStuff()
    Response.Write("In Do Stuff")
end sub
%>

Otherwise the asp in aspfunctions.asp is just seen as plain-text, so as far as the server is concerned, doStuff has never been defined.

like image 37
ConroyP Avatar answered Dec 08 '25 14:12

ConroyP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!