473,387 Members | 3,787 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,387 software developers and data experts.

problem converting classic ASP to .NET

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 try this
"in place" conversion capability that .NET boasts.

the new aspx file, in order to function, will require many includes
from other ASP classic files. it was my impression that ASP.NET and ASP
classic would play well together in the same file, though? if this is
true, can some one tell me what causes the following error?

code from the top of "functions.asp" (the relevant part):

pathvariable = "/mypath/default.asp"

If rcdatabasetype = "MS SQL" Then
rctrue = 1
rcfalse = 0
Else
rctrue = True
rcfalse = False
End If

Function SQLFix(strSQL)
If Trim(strSQL) = "" Then
SQLFix = NULL
Else
SQLFix = Trim(strSQL)
End Function
End Function

code from the top of "testaspx.aspx" (the relevant part):

<%@ Page Language="vb" ContentType="text/html"
ResponseEncoding="iso-8859-1" CodeBehind="testaspx.aspx.vb"
AutoEventWireup="false" Inherits="myproject.testaspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DT*D/xhtml1-
transitional.dtd">
<html>
<!-- InstanceBegin template="/templates/dotnet.dw*t.aspx"
codeOutsideHTMLIsLocked="false*" -->
<head>
<% Response.Buffer = True %>
<!--#include virtual="/pathstuff/constants.*asp"-->
<!--#include virtual="/pathstuff/functions.*asp"-->

but the compiler doesn't get past that bottom line of testaspx.aspx,
because it reports the following error when trying to compile
functions.asp (constants.asp is nothing but variable name declarations,
which is why i left it out of this question):

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

Source Error:

Line 10: End If
Line 11:
*Line 12: Function SQLFix(strSQL)
Line 13: If Trim(strSQL) = "" Then
Line 14: SQLFix = NULL

Source File:

C:\Inetpub\wwwroot\jason.rentc*licks.dev\classifie ds\utilitie*s\functions.asp

Line: 12

this inclusion works just fine in the other 60 ASP classic pages on the
website. can someone point me in the right direction to figure out why
including the same files in an aspx file would fail?

thanks in advance,

jason

Nov 19 '05 #1
4 1701
This is probably not going to work too well.

In ASP.NET, scripts that contain functions must be in <script
runat="server"> tags. And those that are just executable lines in <% %>
tags.

In general, I do not see an advantage to using ASP.NET, if you are still
going to be using the ASP model for how everything is structured.

The 2 technologies are not all that compatible - though some things may work
on both.

But since you are not taking advantage of anything .NET has to offer, I
would just continue doing everything in ASP. Whenever you port your site, it
should be more of a rewrite, so that you can do things in the new object
oriented way, etc.

From my experiencing in working on porting a web based app with hundreds of
asp pages, you really have to do it all at once, and just re do the way
things work. It's not something that lends itself to a gradual transition.

"jason" <ia****@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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 try this
"in place" conversion capability that .NET boasts.

the new aspx file, in order to function, will require many includes
from other ASP classic files. it was my impression that ASP.NET and ASP
classic would play well together in the same file, though? if this is
true, can some one tell me what causes the following error?

code from the top of "functions.asp" (the relevant part):

pathvariable = "/mypath/default.asp"

If rcdatabasetype = "MS SQL" Then
rctrue = 1
rcfalse = 0
Else
rctrue = True
rcfalse = False
End If

Function SQLFix(strSQL)
If Trim(strSQL) = "" Then
SQLFix = NULL
Else
SQLFix = Trim(strSQL)
End Function
End Function

code from the top of "testaspx.aspx" (the relevant part):

<%@ Page Language="vb" ContentType="text/html"
ResponseEncoding="iso-8859-1" CodeBehind="testaspx.aspx.vb"
AutoEventWireup="false" Inherits="myproject.testaspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DT*D/xhtml1-
transitional.dtd">
<html>
<!-- InstanceBegin template="/templates/dotnet.dw*t.aspx"
codeOutsideHTMLIsLocked="false*" -->
<head>
<% Response.Buffer = True %>
<!--#include virtual="/pathstuff/constants.*asp"-->
<!--#include virtual="/pathstuff/functions.*asp"-->

but the compiler doesn't get past that bottom line of testaspx.aspx,
because it reports the following error when trying to compile
functions.asp (constants.asp is nothing but variable name declarations,
which is why i left it out of this question):

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

Source Error:

Line 10: End If
Line 11:
*Line 12: Function SQLFix(strSQL)
Line 13: If Trim(strSQL) = "" Then
Line 14: SQLFix = NULL

Source File:

C:\Inetpub\wwwroot\jason.rentc*licks.dev\classifie ds\utilitie*s\functions.asp

Line: 12

this inclusion works just fine in the other 60 ASP classic pages on the
website. can someone point me in the right direction to figure out why
including the same files in an aspx file would fail?

thanks in advance,

jason
Nov 19 '05 #2
ahh, so this whole theory of "in place" conversion isn't all it's
cracked up to be? i appreciate the commentary!

obviously there's tons of .NET things we eventuallyl want to take
advantage of. but yeah, perhaps piece by piece isn't the way to go
about it.

on this topic, i am writing some .NET middleware objects to retrieve
data. eventually ASP.NET pages will be interacting with these
middleware objects, but in the meantime, how would you recommend
handing a set of data from the .NET objects to the ASP classic? the ASP
classic can't do anything with an SQLDataReader. will i have to create
an ASP classic interface that hands off an old ADO style recordset? is
that even possible in a .NET object, or will it insist on using ADO.NET
objects?

thanks for any help

jason

Nov 19 '05 #3
It is possible to work with the pre-.NET ADO data access objects (2.7
and older). But this incorporates an additional layer (COM Interop),
and can adversely affect application performance.

In addition, it is also possible to write your .NET components so they
are COM compatible (and thereby instanced using the traditional progid
method in ASP) by registering them for COM Interop (which will create
registry entries and a callable type library)... but this is also slow.

Youre better off doing it all in one shot, like Marina suggested.
jason wrote:
ahh, so this whole theory of "in place" conversion isn't all it's
cracked up to be? i appreciate the commentary!

obviously there's tons of .NET things we eventuallyl want to take
advantage of. but yeah, perhaps piece by piece isn't the way to go
about it.

on this topic, i am writing some .NET middleware objects to retrieve
data. eventually ASP.NET pages will be interacting with these
middleware objects, but in the meantime, how would you recommend
handing a set of data from the .NET objects to the ASP classic? the ASP
classic can't do anything with an SQLDataReader. will i have to create
an ASP classic interface that hands off an old ADO style recordset? is
that even possible in a .NET object, or will it insist on using ADO.NET
objects?

thanks for any help

jason

Nov 19 '05 #4
sadly not an option in my current project environment.

i have already made my .NET objects available through COM Interop
successfully. that is how the ASP classic has been making use of the
objects before now.

but up until this point, all of the data has been simple properties
that are easily converted between the two. i'm curious about a more
complex data element, like an SqlDataReader in my .NET object. even if
my object is registered for COM Interop, can the ASP classic get at
that SqlDataReader and interact with it in a meaningful way? (if i were
still at the office, i would simply give it a shot, but i'm on
vacation, yay!)

i'm guessing not, so i need to look into the ability to add a pre .NET
ADO object to the .NET class library, so that when classic ASP
instantiates it through COM Interop, it can actually use the data
access object? or is there someway that it can make use of the
SqlDataReader?

thanks for the comments, btw. and yeah, if i could shut down
development for a good few months to convert the whole thing in one
fell swoop, i definitely would :)

jason

Nov 19 '05 #5

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

Similar topics

7
by: Lastie | last post by:
Hi all, I’ve got a ‘dropdownlist’ web control and I can add ‘listitem’ no problem. I can also bind data from an SQL database fine. My problem is that I want to do both at the same...
2
by: Dave | last post by:
I am converting an ASP Classic web site to an ASP.NET application and have some real basic formatting or design questions. (The classic ASP site has both code (forms) and content pages.) 1.When...
7
by: Greg W via DotNetMonster.com | last post by:
hello all, I have site that I just moved to a new host. It is a dedicated server that sits behind a dedicated firewall. Most of the site uses classic ASP that are working fine but I have some...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
2
by: captain_gni | last post by:
I write a lot of apps in classic asp using ado to pull data from ms sql servers and then I'll use Scripting.FileSystemObject to create/delete xml files, html files or csv files. What is the best...
8
by: antonyliu2002 | last post by:
We are extending a web application written in classic ASP long time ago. We will add more components to this web application in ASP.NET 2.0. To use the web application, our web users will have...
5
by: Patti | last post by:
I am struggling with converting a certain varchar column into an int. I have a table that has 2 fields - one field holds the loan number and the other field holds the codes associated with that...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
1
by: jrod11 | last post by:
I am wrapping up a new website redesign that used to be in classic asp, but I have converted the new one to be .Net. The old site had a login screen that would bring up the web app once logged...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.