473,654 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.a spx" (the relevant part):

<%@ Page Language="vb" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" CodeBehind="tes taspx.aspx.vb"
AutoEventWireup ="false" Inherits="mypro ject.testaspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DT*D/xhtml1-
transitional.dt d">
<html>
<!-- InstanceBegin template="/templates/dotnet.dw*t.asp x"
codeOutsideHTML IsLocked="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\wwwr oot\jason.rentc *licks.dev\clas sifieds\utiliti e*s\functions.a sp

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 1710
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.c om> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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.a spx" (the relevant part):

<%@ Page Language="vb" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" CodeBehind="tes taspx.aspx.vb"
AutoEventWireup ="false" Inherits="mypro ject.testaspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DT*D/xhtml1-
transitional.dt d">
<html>
<!-- InstanceBegin template="/templates/dotnet.dw*t.asp x"
codeOutsideHTML IsLocked="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\wwwr oot\jason.rentc *licks.dev\clas sifieds\utiliti e*s\functions.a sp

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
2032
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 time to allow me to have the first option in the list a ‘listitem’ saying something like ‘please pick an option’, and then the rest of options coming from the database. <asp:dropdownlist id="fm_Category" runat="server"...
2
1670
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 moving a significant amount of content from the ASP classic page (basically formatted text in <P> tags) to an ASP.NET webform, is it better to add it to the webform as HTML or should I put each paragraph into separate (or perhaps a single) ...
7
1769
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 parts that I am converting to .NET that can't seem to access the database. The server is windows 2k3 and I am using SQL Server 2k. In my web config file I have the following connection string:
32
12504
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 Set wsName = DBEngine.Workspaces(0) Set dbName = wsName.OpenDatabase(CurrentProject.FullName) Set rsName = dbName.OpenRecordset("SQL Statement")
2
1223
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 way to learn how to do the same thing using asp.net with ado.net. Thanks! -B
8
2415
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 to log in with their user name and password. Well, instead of adding components to the existing classic ASP web application, we could have just put the extended components into a new web application. But then this would require them to log...
5
11327
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 loan number. Here's some example data: Loan# Codes 11111 24-13-1 22222 1 33333 2-9
28
3574
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 business basic. I need to re-write it, bring it kicking and screaming to run on Windows XP. This is for a video rental place, tracks movie and game rentals, customers, employee transactions, reservations, does reports,..... and on. I know some of...
1
1202
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 in. My question is what steps should i take so that the new website (.net) can login to the web app (classic asp in different folder)? All suggestions are appreciated!
0
8814
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.