Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advice on using ASP.net WebForms or MVC

I have a public facing hobby site that gets about 3000 unique visitors a day, written in classic ASP that is in bad need of a revamp and redesign. I've faced the realization that an upgrade to ASP.net is the best way to go to implement features that are just too hard in ASP for the hobbyist (consuming RSS feeds, authentication and user profiles) but which I'm keen to get stuck into once I get past the redesign/upgrade.

But, I have been paralysed with uncertainty about which way to go: Web Forms or MVC - plus the fact that there always seems to be some new release about to launch that seems like it would be worth holding out for to improve the learning curve. So I spend hours reading about WebForms then read something that tells me I might be better off thinking about MVC, then read about MVC and wonder whether it actually suits what I'm trying to do.

None of the tutorials and starter sites really talk about what works well for sites that are traditional old static information sites (not catalogues or user-content-driven).

My site is about 75% static information pages that rarely change. However, the ASP scripting is essential in the user interface on all those pages - dynamically or randomly picking design elements (like a header photo) or providing a particular sidebar box based on the day of the year or at random.

The kind of scripting I have is things like a script to randomly pick and display one of 30 header images for the page, a script to display text and links based on what day of the year it is, a script that allows me to declare a particular search keyword as being relevant to the content for a particular page and having that pre-loaded as the text in the search input box when the page loads.

For most of the rest of the pages, they are about displaying data. Some of them are small recordsets (almanac type information about what is significant about this particular day of the year) and I save it and pull it from an Array variable in the page itself. Others pull information from an Access database that changes rarely enough that I've never bothered implementing CUD functionality live on the site (and the necessary roles and authentication to secure it), but just update the database offline and upload it to send the changes live.

With ASP.net, I would be fine moving to SQL Server and building live administration pages. I don't need to stick with Access.

But, I'm more used to writing raw HTML and CSS and I'm finding WebForms (especially Viewstate and events/postbacks) a challenge to get my head around conceptually. Even though it seems to fit more with the static page in a file system with some server-side code that I'm used to.

On the other hand, MVC seems to be well suited to lovingly hand-coded design, but where everything gets pulled from a database.

What would you recommend? Should I pull all the static pages into a database and serve them through an "article" view in MVC?

I'm not a professional developer - so it's not about what will look best on my resume. I'm just looking for what will (a) have the least learning curve for someone coming from VBScript inline expressions in classic ASP and (b) what best suits what my site does and (c) lets me have some control over the mark-up and CSS.

like image 995
PapaMac Avatar asked Jan 15 '10 07:01

PapaMac


2 Answers

Definitely go MVC, especially if you're more comfortable as an HTML/CSS guy. Postbacks offer no advantage for a site that is largely static, and it will take months for you to get your head around the page lifecycle (I have yet to meet a developer who was a master of the lifecycle after 6 months of coding in it.)

Converting an ASP classic site to MVC will basically involve moving your HTML and ASP tags into Views, and replicating your existing URL's using the routing mechanisms. You'll need to upgrade your scripts to use some more modern functionality, but that should be fairly straightforward I would imagine.

I do disagree with the idea that in MVC everything is pulled from the database - that's a bit irrelevant to the architecture. I've coded 100% static sites in MVC frameworks and loved it :)

My rule of thumb is trending towards this: "MVC for websites, WebForms for enterprise web applications - maybe."

like image 91
womp Avatar answered Oct 24 '22 20:10

womp


MVC is well suited to what you're doing.

It's perfectly okay to have views which are static, if need be. Just take a look at what's generated by MVC's File->New Project template, for example.

Considering that you're already accustomed to writing HTML/CSS and both frameworks will present a learning curve, I'd definitely recommend MVC. I think you'll find MVC fits requirements A and C much better than WebForms too (and both satisfy B).

like image 32
Dave Ward Avatar answered Oct 24 '22 22:10

Dave Ward