Any way to avoid mass conversion of #INCLUDE files to UserControls?

J

JJA

I have a very large classic ASP site that is making heavy use of
server-side #INCLUDE of .ASP files within .ASP files. I've researched
and seen recommendations describing how you can convert all files to
be included to user controls and then change all including files to
use "register directives" at the top of the file and <UserControl:xxx>
wherever the #INCLUDE file resided in the <BODY of the page.

Furthermore, all "including files" would have to be changed from .ASP
to .ASPX files as I understand it. It gets progressively awkward if a
file is both a main or "including" .ASP file sometimes and is in other
cases #INCLUDEd by other main files.

My question is - Is there any other and easier way to handle a
conversion like this?

My immediate goal is to get this site - www.mortgagedataweb.com -
operational on a new platform - Win2003 Server WebEdition. I used the
IIS Migration Tool as a start but it appears to just copy files and
handle some IIS chores. I know the benefits of UserControls but now I
am trying to just get a site working fast.

Thanks in advance for guidance.
 
J

John Saunders

JJA said:
I have a very large classic ASP site that is making heavy use of
server-side #INCLUDE of .ASP files within .ASP files. I've researched
and seen recommendations describing how you can convert all files to
be included to user controls and then change all including files to
use "register directives" at the top of the file and <UserControl:xxx>
wherever the #INCLUDE file resided in the <BODY of the page.

Furthermore, all "including files" would have to be changed from .ASP
to .ASPX files as I understand it. It gets progressively awkward if a
file is both a main or "including" .ASP file sometimes and is in other
cases #INCLUDEd by other main files.

My question is - Is there any other and easier way to handle a
conversion like this?

My immediate goal is to get this site - www.mortgagedataweb.com -
operational on a new platform - Win2003 Server WebEdition. I used the
IIS Migration Tool as a start but it appears to just copy files and
handle some IIS chores. I know the benefits of UserControls but now I
am trying to just get a site working fast.

Thanks in advance for guidance.

Why not leave it as ASP? Nothing in the world is going to allow an ASP.NET
page to handle an included ASP file if that ASP file uses any features of
ASP which aren't compatible with ASP.NET.

Note that the Find In Files functionality of VS.NET can assist in mass
conversions. It supports regular expressions both in the search and replace
strings. You could first convert your include files into user controls, then
use Find In Files to search for the include and replace it with a
corresponding user control invocation. You could then either manually add
Register directives or paste in a standard series of Register directives.
 
J

JJA

Why not leave it as ASP? Nothing in the world is going to allow an ASP.NET
page to handle an included ASP file if that ASP file uses any features of
ASP which aren't compatible with ASP.NET.

Thank you - this is what I'd like to do - "leave it as ASP"! I'm
having trouble finding info on how to do that. Everything I find on
the subject talks about the merits of and the techniques of converting
to .ASPX and .ASCX.

Could you please sketch out how I get an "unconverted" ASP site
working as is under Win2003 Server running the newest versions of .Net
? I thought I saw a checkbox somewhere in IIS 6.0 labeled as "ASP". I
recall that it was checked.
 
J

John Saunders

x"JJA said:
Thank you - this is what I'd like to do - "leave it as ASP"! I'm
having trouble finding info on how to do that. Everything I find on
the subject talks about the merits of and the techniques of converting
to .ASPX and .ASCX.

Could you please sketch out how I get an "unconverted" ASP site
working as is under Win2003 Server running the newest versions of .Net
? I thought I saw a checkbox somewhere in IIS 6.0 labeled as "ASP". I
recall that it was checked.

Windows Server 2003 supports ASP. What happens when you just try it?

Try creating a site or virtual directory with a simple ASP page, like <%
Response.Write("Hello, World") %>.
 
J

JJA

Windows Server 2003 supports ASP. What happens when you just try it?

Try creating a site or virtual directory with a simple ASP page, like <%
Response.Write("Hello, World") %>.

I was able to create a site called TestASP with a single file called
index1.asp with one line as above and it responds with "Hello World".
When I try to browse my development ASP site, I get:

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to
adjust your browser settings.

Please try the following:

Click the Refresh button, or try again later. <blah..blah..blah>

Cannot find server or DNS Error
Internet Explorer

Here is a few lines snipped from the top of my index.asp page:

<%@ LANGUAGE=vbscript %>
<% Option Explicit %>
<!--#include file="CheckBrowser.asp" -->
<!--#include file="StyleSheet_Init0.asp" -->
<title>MortgageDataWeb - The Best Source for Market Share and Lender
Rankings</title>
<meta name="description" content="The WEB's most comprehensive
mortgage databases and market share reporting system (Conventional,
FHA, VA, and HMDA).">
<meta name="keywords" content="mortgage, market share, FHA/VA, HMDA,
market-share, lender, conventional, jumbo, conforming, loan-to-value">
<% if bNetscape = 1 then %>
<SCRIPT LANGUAGE="JavaScript">
.....etc....

When using Visual Studio.Net 2003 as an editor for this .ASP page, I
get sqiggly lines under all the HTML tags. For example, hovering under
the <title> tag gives the message "Per the active schema, the element
'title' must be included within a parent element". Could that be a
clue that I cannot run the ASP files as they are perhaps?
 
J

John Saunders

JJA said:
I was able to create a site called TestASP with a single file called
index1.asp with one line as above and it responds with "Hello World".
When I try to browse my development ASP site, I get:

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to
adjust your browser settings.

Please try the following:

Click the Refresh button, or try again later. <blah..blah..blah>

Cannot find server or DNS Error
Internet Explorer

Here is a few lines snipped from the top of my index.asp page:

<%@ LANGUAGE=vbscript %>
<% Option Explicit %>
<!--#include file="CheckBrowser.asp" -->
<!--#include file="StyleSheet_Init0.asp" -->
<title>MortgageDataWeb - The Best Source for Market Share and Lender
Rankings</title>
<meta name="description" content="The WEB's most comprehensive
mortgage databases and market share reporting system (Conventional,
FHA, VA, and HMDA).">
<meta name="keywords" content="mortgage, market share, FHA/VA, HMDA,
market-share, lender, conventional, jumbo, conforming, loan-to-value">
<% if bNetscape = 1 then %>
<SCRIPT LANGUAGE="JavaScript">
....etc....

When using Visual Studio.Net 2003 as an editor for this .ASP page, I
get sqiggly lines under all the HTML tags. For example, hovering under
the <title> tag gives the message "Per the active schema, the element
'title' must be included within a parent element". Could that be a
clue that I cannot run the ASP files as they are perhaps?

<title> should be inside of <head>, which should be inside of <html>. Take a
look at your include files to see if one of them contains <html> and <head>.
If one does, then perhaps it is not being processed as an include file.

Also, you might now want to add to your index1.asp step by step, bringing it
closer and closer to the page that doesn't work. At some point, it will stop
working, and that will be a big clue. I try to do this like a binary search.
When I add a chunk and it fails, I then remove half of the chunk I added and
see if it fails. If so, I remove half again, but if not, I add half of the
half chunk I removed...
 
J

JJA

look at your include files to see if one of them contains <html> and <head>.
If one does, then perhaps it is not being processed as an include file.

That's correct. My #INCLUDE files generate the <html> and <head> tags
along with different stylesheets depending on the browser detected. I
guess I don't really know what to expect here. For example, if I OPEN
a .ASP file in Visual Studio.Net and it immediately gives me squiggly
lines it suggests this "editor" cannot see the "runtime effect" of the
#INCLUDE file(s) inclusion. Visual Interdev 6.0 of course never
"complained" about constructs like this. Granted, VS.Net is made for
more powerful things than classic .ASP with #INCLUDEs but is there a
"best practice" or guideline about how to nurse one's old ASP
applications through an existence under VS.NET? For example, should
you use NOTEPAD for editing .ASP files? That is, do you just "put up
with" the apparent inability for VS.Net to recognize that #INCLUDE has
not yet been processed and therefore the HTML tags are naturally going
to be only partially correct?
 
J

John Saunders

JJA said:
That's correct. My #INCLUDE files generate the <html> and <head> tags
along with different stylesheets depending on the browser detected. I
guess I don't really know what to expect here. For example, if I OPEN
a .ASP file in Visual Studio.Net and it immediately gives me squiggly
lines it suggests this "editor" cannot see the "runtime effect" of the
#INCLUDE file(s) inclusion. Visual Interdev 6.0 of course never
"complained" about constructs like this. Granted, VS.Net is made for
more powerful things than classic .ASP with #INCLUDEs but is there a
"best practice" or guideline about how to nurse one's old ASP
applications through an existence under VS.NET? For example, should
you use NOTEPAD for editing .ASP files? That is, do you just "put up
with" the apparent inability for VS.Net to recognize that #INCLUDE has
not yet been processed and therefore the HTML tags are naturally going
to be only partially correct?

I think you're going to get into trouble with #include files which generate
so much of the page structure. You should really work towards not using them
at all (as the subject of this post suggests), but I'd most strongly suggest
that you get rid of any #include files which do things so different from
what ASP.NET does.

Note that ASP.NET does everything as controls. A control doesn't generate
some arbitrary string of text which may or may not be contributing to a
valid stream of HTML. Instead, controls usually generate something
self-contained. They generate something which would be valid if the control
were moved somewhere else.

So, it would be tolerable if your #include file were to generate some tags
within the <head> area, or some tags within the <body> area, or if it
generated a <td> ... </td>, or a <tr> ... </tr>, or <table> ... </table>, or
something self-contained like that.
 
J

JJA

Thanks very much for your input on this. I follow what you mean about
"self-contained functionality" and for the most part I've tried to
make the output of a given INCLUDE file a separate piece of
functionality.

I intend to get to ASP.NET user controls but the thrust of my question
has been how to get the ASP simply working at all. I now know a bit
more of what to expect. Part of my problem was that the IIS 6.0
Migration Utility messed up part of my metabase. I think it is OK now.

In summary, I'd love to hear your comments on the "squiggly line
complaints" of the VS.Net editor that I raised in the post above. Is
it best practice to just ignore that, use Interdev, use NotePad, or is
there some tweak to VS.Net to get it to "calm down" when simply
editing an old .ASP file with some of the HTML not fully developed
until runtime?
 
J

John Saunders

JJA said:
Thanks very much for your input on this. I follow what you mean about
"self-contained functionality" and for the most part I've tried to
make the output of a given INCLUDE file a separate piece of
functionality.

I intend to get to ASP.NET user controls but the thrust of my question
has been how to get the ASP simply working at all. I now know a bit
more of what to expect. Part of my problem was that the IIS 6.0
Migration Utility messed up part of my metabase. I think it is OK now.

In summary, I'd love to hear your comments on the "squiggly line
complaints" of the VS.Net editor that I raised in the post above. Is
it best practice to just ignore that, use Interdev, use NotePad, or is
there some tweak to VS.Net to get it to "calm down" when simply
editing an old .ASP file with some of the HTML not fully developed
until runtime?

Ignore the squiggly lines until you get further in your conversion. Once
things have calmed down a bit, you'll find many of the squiggly lines to be
useful. For instance, a web site I know of, converted from ASP, used to have
several invalid attributes on the <body> tags. We happen not to have
received any complaints from customers who saw a strange site.
 
J

JJA

Why not leave it as ASP? Nothing in the world is going to allow an ASP.NET
page to handle an included ASP file if that ASP file uses any features of
ASP which aren't compatible with ASP.NET.

I am still really confused about how "regular, old, classic" .ASP
files
written with server side VBScript code are supported in the new
environment of .Net running on Windows Server 2003.

I was making some progress (trying to "leave it as ASP") and I thought
I understood that ASP was supported within the new environment. Then I
got:

VBScript runtime error '800a0005'
Invalid procedure call or argument 'Left'

This fails on an assignment statement that uses the VBScript Left
function. Then I found some notes somewhere that describes how Left
and many other functions are "not supported" and have VB.Net
equivalents.

So I am confused about the suggestion to run .ASP files
with VBScript in .NET. I took this to mean that VBScript would behave
like it does under IIS 4.0 (for example, run time interpreted code,
etc.)

Now it is starting to dawn on me that even though it looks like
VBScript and resides within a file whose extension is .ASP not .ASPX,
it is not really VBScript but rather VB.Net. I am deducing this
because the Left function is disallowed. I am assuming that the
VBScript code that is working so far is actually being compiled (i.e.
treated like VB.Net code and working only because the pieces I've run
so far are compatible - until I ran into the Left function).

In short, is there any way to postpone all the wonders of ASP.Net and
VB.Net and get an ASP-based site written in VBScript to work without
conversion (in this case, the Left function but I know I'll run into
more things like this as I continue testing).
 
J

John Saunders

JJA said:
I am still really confused about how "regular, old, classic" .ASP
files
written with server side VBScript code are supported in the new
environment of .Net running on Windows Server 2003.

I was making some progress (trying to "leave it as ASP") and I thought
I understood that ASP was supported within the new environment. Then I
got:

When I said, "leave it as ASP", I meant that. I didn't mean "rename a .ASP
file to .ASPX". The same web site can contain both .aspx pages and .asp
pages.
 
J

JJA

When I said, "leave it as ASP", I meant that. I didn't mean "rename a .ASP
file to .ASPX". The same web site can contain both .aspx pages and .asp
pages.

Yes, I know. All my files are still .ASP. Here a function in one of my
include files:

Function EnDeCryptXOR(ByVal OTPadKey, ByVal CPText)
Dim Counter, Size, KeyCounter, KeySize, arrKey
OTPadKey = CStr(OTPadKey)
KeySize = Len(OTPadKey)
ReDim arrKey(KeySize)
CPText = CStr(CPText)
Size = Len(CPText)
For KeyCounter = 1 To KeySize
arrKey(KeyCounter) = Mid(OTPadKey, KeyCounter, 1)
EnDeCryptXOR = EnDeCryptXOR & _
CStr(Asc(arrKey(KeyCounter)) Xor Asc(Mid(CPText, ((KeyCounter mod
Size) + 1), 1))) & ","
Next
EnDeCryptXOR = Left(EnDeCryptXOR, Len(EnDeCryptXOR)-1)
End Function ' EnDeCryptXOR

This fails with:

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Left'
/devmdw/XOR/XOR.asp, line 21

So, what to conclude of this? VBScript's LEFT function is apparently
not allowed in VB.Net. So I have to rewrite with an equivalent
function (e.g. use of the Substring method of the String class)?

But doesn't that suggest that ALL of what appears to me like VBScript
in my .ASP files is in fact being treated like VB.Net?
 
J

John Saunders

JJA said:
Yes, I know. All my files are still .ASP. Here a function in one of my
include files:

This fails with:

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Left'
/devmdw/XOR/XOR.asp, line 21

So, what to conclude of this? VBScript's LEFT function is apparently
not allowed in VB.Net. So I have to rewrite with an equivalent
function (e.g. use of the Substring method of the String class)?

But doesn't that suggest that ALL of what appears to me like VBScript
in my .ASP files is in fact being treated like VB.Net?

No. It says "VBScript", so it's ASP.

The error message says invalid procedure call or argument, so maybe it's not
the procedure call, but the arguments. Try Left("12", 1) and see what
happens. If it works, then maybe the problem is with EnDeCryptXOR or
Len(EnDeCryptXOR)-1. Note in particular that if Len(EnDeCryptXOR)=0, then
Len(EnDeCryptXOR)-1 = -1, which I bet Left doesn't like much.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top