We help IT Professionals succeed at work.
Get Started

migrate asp functions to asp.net

Last Modified: 2013-11-25
I have some asp pages with functions and I want to keep them as is during my migration to asp.net.  How do I do this?

All I really want to do is to change the page to an .aspx page (so I can use masterpages and get the page template I want).  However, it appears that I can't have an inline function in an aspx page.

For example, below I pasted some classic asp code into an aspx page

aspx page...


function myFunction(value)
 myFunction = value & " there!"
end function
</body> ...

When I try to run that in asp.net I get the error:

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

Source Error:

Line 19: response.write(myFunction("Hi"))
Line 20:
Line 21: function myFunction(value)
Line 22:  myFunction = value & " there!"
Line 23: end function
I get the error on line 21
I don't want to migrate this to the code behind (royal pain) or into a control (even worse).  Ideas?

Watch Question
Top Expert 2007
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE