1

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?

11
  • 1
    MVC, it's too ASP.NET. Do you mean you want to use web forms instead MVC? You can just choose ASP.NET Web Form Application in VS or just web site without project. But I think that MVC is more progressive and advanced technology. In web form application you just create page with code behind. Of course you can use layers, moving some code to libraries. Commented Dec 8, 2012 at 17:47
  • 2
    Double post? Commented Dec 8, 2012 at 18:00
  • Yes i want to use ASP.NET web applications, where web files have code behind files. I know MVC is more advanced, but i'd like to know more about ASP.NET Web Forms aswell. Specifically a good structure to organize my code. If theres such a thing. Commented Dec 8, 2012 at 18:00
  • Not sure about code structure, I think it depends on type of site. What you should know about web forms, it's ASP.NET Page Life Cycle: msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx Commented Dec 8, 2012 at 18:24
  • 1
    The new Microsoft Web Applications certification (microsoft.com/learning/en/us/mcsd-web-apps-certification.aspx) exam set includes an exam on ASP.NET MVC. The 2010 equivalent was much more WebForms oriented. This isn't to say that Web Forms isn't important or will be discontinued, but Microsoft is clearly shifting their weight behind MVC. I would think twice before abandoning MVC for WebForms. Commented Dec 8, 2012 at 18:39

3 Answers 3

3

Basics - "MVC", "web forms", "web site project", "web application project" are all ASP.Net. You can mix/match as you please - e.g. I can have a Web API project with a webform1.aspx in it. You can have vbhtml/cshtml (razor) files and aspx files (webforms) in the same application. I can have web forms, generic handlers, etc., in an MVC application...and so on. they are all "under" ASP.Net.

The other answers provide you with structure you can use for ASP.Net web applications/sites - you will notice it is "tiered" - aka - "business layer", "data layer", etc. which also apply to MVC. If you get past the terminology, I think it's all about "separation of concerns" (aka "tiered", reusable, unit testable, etc.).

Sign up to request clarification or add additional context in comments.

Comments

2

In the past, when building ASP.NET applications, I found the Model View Presenter design pattern to be quite useful in extracting all the code-behind to a presentation layer (separate class library with no ties to web assemblies).

That allowed me to unit test all presenters and logic, and just consider ASP.NET as the implementations of the IViews.

In that approach I'd usually have:

  • UI (Web application project)
  • UI Common, controls, etc class libraries
  • Presentation class library
    • Presenters usually contained business logic, they were not tied to ASP.NET
  • Presentation support class libraries
  • Data Model class library (EF, NHibernate, etc)

And depending on the application you may need a separate business layer between presentation and the data model, and get the logic out of the Presenters.

Comments

2

Actually if you have big enough web site, solution should include the following projects:

  1. web application itself
  2. business logic layer
  3. data-access layer
  4. entities (if you're using entity framework)
  5. maybe web controls project

It can be more or less depending on your site. For simple site you can have only web application with just several aspx pages.

Not sure if it's answering to your question.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.