ASP to ASP .NET BC30289

  • Thread starter Thread starter Marcel Balcarek
  • Start date Start date
M

Marcel Balcarek

I am converting an ASP page to ASP .NET (not a rewrite).
I have renamed my ASP page to ASPX, but have one remaining issue.
My ASP has some functions after the mainline code, but when I run the code I
get the following on the function definition line:

BC30289: Statement cannot appear within a method body. End of method
assumed.

<%
mainline ASP code
..
..
..
Function ChangePassword()
...
End Function
%>

How can I resolve this? Thanks
Marcel
 
ASP.NET will not allow you to declare functions between <% %> tags. This is
because any code between those tags gets added to the body of a render
method at runtime. You have to wrap function defs in <script> tags like so:

<script language="VB" runat="Server">
Function ChangePassword()
..
End Function
</script>
 
In addition to Bryant's comments, you really will want to do more than just
change the file extension to upgrade to ASP .NET & VB .NET.

VB .NET has undergone many changes and you will want to eliminate as much of
the old baggage as possible.
 
Thanks Bryant,
That helped a lot.

I notice that the Function no longer has access to any global variables
defined in INCLUDES
such as the ado predefined variables and my own globals - do I simply have
to pass them in as variables, or is there another way?

Thanks again. Marcel
 
If you need to define global variables, you will have to put them in
<script> blocks as well. Think of it like this, anything within those
<script> blocks gets put into an auto-generated class file while anything in
the <% %> blocks gets put inside a render method of that class. So if you
want to have access to variables outside of just the render method they need
to be declared in <script> blocks.

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com
 
Marcel said:
Thanks Bryant,
That helped a lot.

I notice that the Function no longer has access to any global variables
defined in INCLUDES
such as the ado predefined variables and my own globals - do I simply have
to pass them in as variables, or is there another way?

Thanks again. Marcel

As written by Scott, there is no sense in making it .net, by just
changing the file-ending. The best result, if posible, would be a total
rework.
 
Back
Top