473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP to ASP .NET BC30289

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
Nov 18 '05 #1
5 6511
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>

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Marcel Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2
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.
"Bryant Hankins" <bryanthankins@_NO_SPAM_hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
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>

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Marcel Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
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


Nov 18 '05 #3
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
"Bryant Hankins" <bryanthankins@_NO_SPAM_hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
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>

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Marcel Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
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


Nov 18 '05 #4
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 Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
"Bryant Hankins" <bryanthankins@_NO_SPAM_hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
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>

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Marcel Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message news:Or**************@TK2MSFTNGP10.phx.gbl...
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



Nov 18 '05 #5
Marcel Balcarek wrote:
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.

--
/Anders
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Troy | last post by:
After binding my data to the datalist I have created this function. I am recieving an error: BC30289: Statement cannot appear within a method body. End of method assumed. Does anyone have any...
0
by: Mike Wilmot | last post by:
In converting a page from ASP to ASPX, I am getting the error: BC30289: Statement cannot appear within a method body. End of method assumed. when running the code below. It has something to do...
3
by: Wayne Wengert | last post by:
I am trying to run the web page example given in the VSNET 2003 Help for "Introduction to the DOM". I saved the example as an aspx page but when I run it I get the following error which I don't...
4
by: Marcel Balcarek | last post by:
I am converting an ASP page to ASP .NET. The original has the following: #INCLUDE FILE="logAction.asp" The included file holds some commonly used methods. When I rename it to aspx files and...
0
by: Carlos Oliveira | last post by:
For ASP.NET beginners (like me): I'm trying to migrate "easily" my ASP pages to ASPX pages. Of course, I found the error below: BC30289: Statement cannot appear within a method body. End of...
5
by: Jeff via DotNetMonster.com | last post by:
Hi, I'm trying to open a new window to bring up an external link once a value is selected from a drop down list. I'm trying the following but I get the error: 'If' must end with a matching...
1
by: jason | last post by:
i'm working on a gradual conversion of an ASP classic web site to ASP.NET. a recent body of work involves adding a new asp page to the existing site. i thought this would be a good opportunity to...
4
by: jason | last post by:
i'm working on a gradual conversion of an ASP classic web site to ASP.NET. a recent body of work involves adding a new asp page to the existing site. i thought this would be a good opportunity to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.