ASP.NET for ASP Classic Veteran

G

GrindKore

Hello, I have been coding in VBScript ASP Classic for over 6 years now.
Hundreds of commercially successful intranet portals and applications been
written by me utilizing ASP/COM+/SQL technologies but I still can't get my
mind around ASP.NET.

I have been playing with VS.NET since 2002 and have coded some win32
clients with it, have read many .NET books and have solid understanding of
..NET framework and applications, but just cannot understand how to develop
large enterprise projects using ASP.NET.

For example I can open VS.NET create new aspx page, drop a few grid
controls, bind them to dataset, customize them, pretty much do everything I
learned from books and online tutorials. What I don't understand is how to
link all these aspx pages together in to one continues webapp. Perhaps part
of my problem is that I do not use Visual InterDev 6.0 for my classic ASP
projects, instead I prefer to handcode my ASP/HTML code using Homesite 5.0.
For some reason drag-n-drop style of programming just does not work for me,
I prefer to write my code from A to Z by hand. I feel that ASP.NET
development in VS.NET is almost 80% drag-n-drop am I missing something?

Another issue is code reuse. In ASP classic I use includes to contain
common items such as headers, footers, menus, global constants, etc. In the
majority of ASP.NET literature I have read this issue is never discussed
with details, most books focus on functionality of specific controls and
classes and how to make them work and look pretty but not now to put them
together in large project.

Perhaps I need a paradigm shift, but I sure as hell would like to know
how get there. I apologize for a long rant, I hope someone has/had similar
feeling and provides a suggestions for me and others that might come across
this post in the future.
 
G

Guest

code reuse: Create your reusable code in classes and reuse those classes.
If it's something to be used across multiple apps compile the classes into
dlls and reference those.

In my opinion, to create truly good and reliable apps you must code by hand
still. I have never used the drag and drop style on any real application.
It takes a while to figure out how to do everything by hand but it's still
possible and I think, easier to do everything by hand.
 
D

David Wier

For one thing - VS.Net is solution/project based......
So - I totally understand your pain....

Also - A lot of people think, that since User Controls have been added to
ASP.Net, that Includes are gone - - totally not correct!
I use basic headers and footer in several places, just as I did before....in
others, I did need to modify the code somewhat to comply with ASP.Net
standards.

in short - as before, VS.Net is not the only game in town and codebehind is
not the only way to program - there are other editors on the market, along
with Inline scripting, instead of Codebehind - - - you need to use the
development method that fits your needs and your way of programming in the
best way. There's nothing wrong with hand-coding - you have total control
that way.

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
 
R

Rob

The paradigm shift you could be looking for is object-oriented
programming. This is fairly fundamental to understanding .NET
framework.

....or am i barking up the wrong tree?
 
G

GrindKore

I know my way around .NET framework, I have already coded windows
application
and class libs using VB.NET so all OOP concepts are not new to me. I love
new multithreading capability
it was a pleasure finally getting rid of my old VB6 ActiveX.EXE's in favor
of clean oop implementation.
Even in VB6 most of my projects were class based with interfaces and
polymorphism.

My problem is specifically with ASP.NET design patterns, I think I miss some
critical knowledge that
prevents me from getting a bigger picture.
 
R

Rob

Ok, apologies for suggetsing otherwise, i was only trying to help.

Must admit that ASP.NET has been a complete breathe of fresh-air to me
after classical ASP. Tons of things i used to set up in ASP/Javascript
by hand now come from free in ASP.Net.

I hand-code most of the stuff myself, but Visual Studio.Net (even
without using drag-and-drop) makes the task soooooooooo much each
easier with code completion, paramteter prompting etc. and performance
is so much better than classical asp.

UserControls and Custom Web Controls are specifically designed for
re-use (these replace the included headers of asp) and their very easy
to create with all the built-in event-handling hooks as well

So, sorry i don't know what to suggest.
Rob
 
G

GrindKore

Lets assume typical webapp contains at least three elements that need to be
consistent across multiple pages
(header, footer, menu) does this mean I have to make custom webcontrol for
each element and drag it on to
new aspx page? And for common code I should make separate assembly or at
least namespace that contains my classes?

Thank you for replies, I'm just trying to get a grasp on some concepts.
 
K

Kevin Spencer

For example I can open VS.NET create new aspx page, drop a few grid
controls, bind them to dataset, customize them, pretty much do everything I
learned from books and online tutorials. What I don't understand is how to
link all these aspx pages together in to one continues webapp. Perhaps part
of my problem is that I do not use Visual InterDev 6.0 for my classic ASP
projects, instead I prefer to handcode my ASP/HTML code using Homesite 5.0.
For some reason drag-n-drop style of programming just does not work for
me,

There is a toolbox. You can drag and drop some controls with it. However, I
for one almost never use it, unless I'm working on a Windows Forms app. Just
because it's there doesn't mean it is the only, the best, or the recommended
way of building your app. Think of VS.Net as a toolbox. You only have to use
the tools you need. It's a big enough toolbox so that almost everyone can
find the tools they need and prefer to work with. But I would guess that I
haven't used half of them yet. I would guess that almost nobody does use
half of them.

When you drag and drop a tool from the toolbox to a WebForm, all it does is
write some code for you, and not a lot of it. It is just about as fast to
write it yourself. At least, when I use the toolbox, I almost always go into
the code and tweak it by hand. But that's my style.

The ASP.Net "paradigm," if you will, is that of making a web application
work more like a Windows Forms app, in that each WebForm is like a Windows
form, and just as a single Windows Form app can employ many forms for
dialogs, input/output, etc, so an ASP.Net app can have many WebForms. Of
course, the interface is HTML, so you don't have as much freedom with the
painting of it, but you can get pretty darned granular with it if you work
hard.

Reusability of code is one of the central pillars of Object-Oriented
Programming. A class is a nice little self-contained set of data and
behavior, which can be plugged into many applications, if you build it
right.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
R

Rob

You already seem to have a good grasp to me. To include a header,
footer, menu the easiest way is to add a user control (.ascx) file.
This can just contain plain old html. Then to include this in another
page:

1) Add this line at the top:
<%@ Register TagPrefix="MM" TagName="header" Src="header.ascx" %>

2) Add this line in the .aspx source where you want the header to
appear:
<MM:header id="ctlHeader" runat="server"/>

Creating a re-uable custom web controls and including it in your Tools
pallet requires a bit more work, but is still fairly straightforward.

Both user controls and custom web controls can have public properties,
code-behind files can respond to events just like a normal .aspx
file.

To create common classes, you could do any of:

1) Copy the classes by-hand between projects (obviously each project
gets a separate copy of the source code in this case).

2) As you suggest, build it as part of a separate assembly/namespace
and include the reference the built assembly within each project. (Has
the advantage of a single copy of the source). Assembly gets deployed
in the bin subdirectory of the project.

3) Deploy the assembly in to the GAC (Global Assembly Cache). This is
more work to manage and deploy but means all projects can share one
instance of the same assembly.

Hope this helps.
 
G

Guest

You and I are on the same boat.

I've been frustrated for years with asp.net. In my opinion asp.net wasn't
something I could work with, but that is truely changing with asp.net 2.0. If
you havent read through all the asp.net 2.0 on
http://msdn.microsoft.com/asp.net/whidbey/ then I highly recommend that you
do. For me I found that most of the code libraries I've been using for years
in clasic asp have finally been handled by asp.net 2.0. I tried creating
custom controls and such, includiing master pages and custom grids, but that
was too much work for the gain.
 
G

Guest

Recently I've found myself in the same situation you describe. I've also
been asked to prototype a new user interface using ASP.Net for our current
ASP product. By far the best advice I can give anyone (and I apologize is
this is oversimplified) is as follows:

-- Override the Page class - you can override the Page class and have your
aspx files inherit from your class. This allows you to setup a page template
or framework that all pages can use.

-- Use Custom Web Controls or User Controls when possible - For example, we
often use a date range for users to pull reports on. I created a date range
custom web control that is now used for all of our selection pages.

-- Drag and Drop design - I am extremely hesitant to add code to my page
using drag and drop techniques. However, drag and drop is a good way to get
a web control on a page with default properties. Once the web control is on
the page, I switch to html style coding.

I hope this helps a little. If you are looking for any examples, I would be
happy to share.

Steven VanHise
 
G

Guest

GrindKore,

Let me give you a good news first,
The newer version ASP.NET 2.0 is going to be much more easier that earlier
one.

Now the bad one, As far as the differnce in ASP and ASP.NET is concern, it
is VAST. And if you really want to do coding in .Net, first thing you will
have to do is, forget the way you were coding in ASP (this is true even with
WinForm, especially if you were using VB6 or like)

The other work-around is (which I dont suggest) continue in ASP, it is 100%
compatible (as long as your extenstion is .asp and not .aspx), even then you
have performance enhancement. Try avoiding spagetti coding, put them in the
<script></script> tag. Suddenly, one fine day (when you have been able to
remove all the spagetti code, and able to put them in one <script></script>
block at top, using functions & procedures, i.e. subs) you will find, that
the .asp page compiles with .Net, as it is.

As the IndianGuru had said, "you will need more than double time & effort to
mentor a half-pandit, then the fresh one"

Good Luck
 

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

Top