ASP to ASP .NET BC30289

  • Thread starter Marcel Balcarek
  • 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
 
B

Bryant Hankins

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>
 
S

Scott M.

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.
 
M

Marcel Balcarek

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
 
B

Bryant Hankins

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
 
A

Anders Matthiessen

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.
 

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

Top