Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've always coded in C# MVC3 when developing web applications. But now i wanted to learn a bit more about developing web sites with just ASP.NET.

But now i'm wondering what a good setup for my code would be. For me, an MVC like pattern seems to be a good way to go. But obviously ASP.NET doesn't have any router and controller classes. So i guess people have a different way of setting up their code when they do ASP.NET.

So i'm looking for more information on how to get started with this. So not really the basics of ASP.NET, but something that focuses on a good code setup.

Any good tutorials/information about this/?

share|improve this question
2  
Can you clarify whether "with just ASP.NET" means using WebForms (i.e. pre-MVC ASP.NET, .aspx pages with codebehinds and postbacks), or whether it literally means with just ASP.NET, no framework at all, writing HTTP handlers manually? –  Carson63000 Dec 8 '12 at 19:41

3 Answers 3

up vote 3 down vote accepted

If what you're referring to is ASP.Net Web Forms, best practices are somewhat of an opinionated and difficult to find topic (given that its conventions are very one-sided). However in your case I would highly recommend getting familiar with what's new in ASP.Net 4.5 for web forms first. Features like Model Binding will help you cross-over into familiar territory. If you have used aspx views in any of your MVC projects you'll have a great head start too. For web forms design in general, many of the older conventions on best practices still hold true from days past. There are some more unconventional approaches to web forms that may be worth a look. Web forms MVP is one and also the Spring Framework for .Net has a very nice adaptation that makes excellent use of Spring's features to improve the web forms model greatly.

All in all web forms is good to know but IMHO you should stick with MVC and shoot for learning MVC4 and the new Web Api.

share|improve this answer

MVC3 is ASP.NET in every sense. It seems like you are referring to WebForms, which is the old platform for creating websites in ASP.NET. But I think you'll find MVC to be a much better platform.

As mention by Alex, MVC offers a better separation of concerns by following the Model-View-Controller pattern, which can be implemented in WebForms, but has native support in MVC. It also offers better HTML code generation using the Razor engine, which I find pretty smart in most cases and very clean, simple code. Better file structure, and other features to keep the development on the actual site rather than handling requests back and forth IMHO.

share|improve this answer
    
Why? Why will they find MVC to be a much better platform? Please expand your answer. –  Walter Dec 8 '12 at 19:19
    
separation of concerns, better control of HTML generation –  Alex Dec 8 '12 at 19:24
    
@Walter Updated the answer. –  rae1 Dec 8 '12 at 19:54
1  
I think the .NET team have been clear that neither Web Forms nor MVC are 'better', but rather both are available alongside one another and suited to different situations. –  James Dec 8 '12 at 23:33
1  
@Rythal Having had personal experience with maintaining a large number of legacy web form apps, such well designed web form apps are exceedingly rare. It almost defeats the purpose of SmartUI. Unless you have no other choice you will probably use MVC when you reach such a level of complexity. –  NickSuperb Dec 10 '12 at 22:34

You can get very MVC-like in current versions of webforms; features such as routing and model binding have found ways into that part of the framework.

In general, the right way to do .NET apps on any platform is to build a core library that is UI agnostic and tie the UI layer in. If you do it right you can deal with anything -- be it WebForms, MVC, WPF or a console app -- without significant pain.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.