ASP.NET Common Usage (Debate Please)

D

DaBrain

Many thank to anyone who has the time to read an reply to this.

Am a lone gun developer, I do not develop in team so this question
comes from a place where I just don't really KNOW what others are
doing, I just read, and what I read is ALL about Web Forms ONLY.

I have been developing web sites since 1995, then it was all PERL/CGI,
HTML on UNIX Now I am making the transition from ASP to ASP.NET. I am
developing in C# now.

My question is based around the concept of True "Web Forms"
Development, using Post Backs etc. As a developer I want to develop in
this manner because it is the Correct way to develop today. But in
some cases for example, in an online catalog, you want to use Query
string, Not only are catalog pages bookmarkable that way but the
navigation (back ,forward function)

The problem is this, as a responsible developer making a transition to
the new ways ... every time I develop something with a QueryString
(?printable=1 ... ?productid=54654) I feel as though I am breaking the
rules, reverting to old ways, not accepting the transition as it should
be. - I think. "what have I missed"

While I do use and enjoy true Web Forms development, custom controls,
and user controls...

....Is it also common to use GET requests in lots of your design? Should
I just think of ASP.NET web forms as a new and powerful "option"
available to me or should I think of it as the new must method of
design if you are going to use ASP.NET

Is it a case of:
Web forms are just a tool, use 'em when you can don't feel guilty
when you don't -- mix it up as you see fit you got the experience,
stop overthinking it! Nothing wrong with a querystring as long as your
code is good.

I think I need mentoring here, assurance, something like that. -
Strange that is.


Thank you very much for any replies
 
L

Laurent Bugnion

Hi,
Many thank to anyone who has the time to read an reply to this.

Am a lone gun developer, I do not develop in team so this question
comes from a place where I just don't really KNOW what others are
doing, I just read, and what I read is ALL about Web Forms ONLY.

ASP.NET gives you a high level of comfort, by wiring the events,
automating a lot of tasks, making the web react more like windows.
However, I don't really agree with you when you say that postbacks are
the Correct way. I think that POST has a lot of issues, for example when
your end user refreshes the page and gets asked if he wants to resubmit.
Also, don't forget that POST requests cannot be saved, when GET requests
can get stored in a bookmark.

As you say, my strong opinion is that there is nothing wrong in doing
GETs, and you really shouldn't get inhibited. The art of engineering is
knowing when to choose which technology. On the web, we have POST and
GET, and both have advantages and inconveniences. You have a huge
advantage on new developers who only worked with .NET, and this is that
you understand the depths of the HTTP protocol, because you come a long
way. Make sure to use this advantage when you work on a project.

Nothing wrong with a querystring :)

Feeling better?

HTH
Laurent

PS: some will argue that the Correct way to go nowadays is to use AJAX ;-)
PS2: And guess what, it comes with GET and POST too
 
K

Karl Seguin [MVP]

Well said, and I agree.

I'll take it a step further, and say that I'll sometimes use postback, but
peek inside Form["__EVENTTARGET"] and such to shortcircuit a bunch of code.
This is a hack, and I only do it when I feel the ends justify the means
(namely when I have heavy code that can't be moved to prerender and I might
want to skip it depending on which button was clicked).

The querystring example is a good one. I might recommend that you consider
using url rewriting and cleaner URLs instead, but the difference is small. I
use it plenty of times. There are A LOT of times where I'll use plain old <a
href="xxx"></a> tags instead of LinkButtons. It just makes more sense and
it's better for the user (bookmarks). Sometimes a linkbutton makes more
sense.

To me, the real purity of ASP.NET comes in the form of custom web controls
(even very simple ones), httphandlers, httpmodules and good OO design.

Karl
 
S

Steve C. Orr [MVP, MCSD]

I think GETs are common enough in ASP.NET that you don't have to worry about
using them. It it is a fairly standard practice. There is nothing wrong
with GETS or POSTS and just to confuse things further there are plenty of
other good options for passing data around too, such as Application State,
Session State, ViewState, Cache, Cookies, Databases, etc.
Which one is best depends on your situation and is largely a matter of
opinion after weighing various factors such as the amount of data,
usability, efficiency, available resources, etc.
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top