Questions tagged [asp.net-mvc]

The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern.

The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern. Based on ASP.NET, it allows software developers to build a Web application as a composition of three roles: Model, View and Controller.

A model represents the state of a particular aspect of the application. Frequently, a model maps to a database table with the entries in the table representing the state of the application. A controller handles interactions and updates the model to reflect a change in state of the application, and then passes information to the view. A view accepts necessary information from the controller and renders a user interface to display that.

Also check out Nuget to use MvcScaffold to quickly build boiler plate code from POCO classes.

The latest stable version - MVC 3 - is available from the Microsoft Download Center website.

Latest announcements from Microsoft usually come from Scott Guthrie's blog. Other notable blogs relating to MVC include Phil Haack, Scott Hanselman, and Brad Wilson.

557 questions
339
votes
14 answers

Should you write your back-end as an API?

I had a heated discussion today about our MVC application. We have a website written in MVC (ASP.NET), and it usually follows the pattern of do something in the view -> hit the controller -> controller builds a model (calls a Manager that gets the…
NibblyPig
  • 2,995
  • 3
  • 16
  • 19
242
votes
9 answers

Why shouldn't I use the repository pattern with Entity Framework?

During a job interview, I was asked to explain why the repository pattern isn't a good pattern to work with ORMs like Entity Framework. Why is this the case?
StringBuilder
  • 2,545
  • 3
  • 13
  • 4
195
votes
19 answers

When to favor ASP.NET WebForms over MVC

I know that Microsoft has said ASP.NET MVC is not a replacement for WebForms. And some developers say WebForms is faster to develop on than MVC. But I believe speed of coding comes down to comfort level with the technology so I don't want any…
P.Brian.Mackey
  • 11,123
  • 8
  • 48
  • 87
94
votes
6 answers

What's the difference between stateful and stateless?

The books and documentation on the MVC just heap on using the Stateful and Stateless terms. To be honest, i am just unable to grab the idea of it, what the books are talking about. They don't give an example to understand any of the either state,…
Pankaj Upadhyay
  • 5,060
  • 11
  • 44
  • 60
51
votes
7 answers

Why does everyone put controllers in one folder and views in another?

I'm getting ready to take the bend out of asp and into an mvc framework, asp.net mvc or nancy. Wherever I go, I see folders for controllers/modules and folders for views. Is this just a pavlovian reflex of tidying things away by type, or is there…
bbsimonbb
  • 739
  • 1
  • 6
  • 12
50
votes
1 answer

Is FormsAuthentication obsolete?

I am creating a website using ASP.NET MVC 5. Has Microsoft release any technology to replace FormsAuthentication or do they still recommended authenticating the user using FormsAuthentication for MVC 5? UPDATE Jan 2020: It's been almost 5 five…
sean717
  • 677
  • 1
  • 5
  • 8
50
votes
2 answers

Why does the .Net world seem to embrace magic strings instead of staticly typed alternatives?

So, I work in .Net. I make open source projects in .Net. One of my biggest problems with it isn't necessariyl with .Net, but with the community and frameworks around it. It seems everywhere that magical naming schemes and strings is treated as the…
Earlz
  • 22,658
  • 7
  • 46
  • 60
44
votes
2 answers

What are the definitive guidelines for custom Error Handling in ASP.NET MVC 3?

The process of doing custom error handling in ASP.NET MVC (3 in this case) seems to be incredibly neglected. I've read through the various questions and answers here, on the web, help pages for various tools (like Elmah), but I feel like I've gone…
RyanW
  • 829
  • 1
  • 6
  • 10
40
votes
2 answers

Mixing Angular and ASP.NET MVC/Web api?

I come from using ASP.NET MVC/Web API and now I am starting to use Angular but I am not clear on the proper way to mix them. Once I am using Angular does the MVC server side concepts still provide any value? Or should I strictly be using Web API…
punkouter
  • 1,123
  • 2
  • 10
  • 18
37
votes
7 answers

What ASP.NET MVC can do and Ruby on Rails can't?

ASP.NET MVC and Rails have similar area of use, are built around same architecture, both frameworks are relatively new and open source. So as a Rails programmer I'd like to know, what ASP.NET MVC can do and Ruby on Rails can't, and visa versa?
Nikita Barsukov
  • 1,265
  • 1
  • 9
  • 12
36
votes
2 answers

Separating data access in ASP.NET MVC

I want to make sure I'm following industry standards and best practices with my first real crack at MVC. In this case, it's ASP.NET MVC, using C#. I will be using Entity Framework 4.1 for my model, with code-first objects (the database already…
scott.korin
  • 543
  • 1
  • 5
  • 9
33
votes
6 answers

Why would you ever 'await' a method, and then immediately interrogate its return value?

In this MSDN article, the following example code is provided (slightly edited for brevity): public async Task Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } …
Robert Harvey
  • 198,589
  • 55
  • 464
  • 673
33
votes
4 answers

Why is there no WSDL type support for Web Api?

So I am just getting started with .Net WebApi and one thing that I am noticing straight away is that there is no Contract defining how the API looks and should be consumed (Request/Responses from each Action), this is usually in the form of a WSDL…
shenku
  • 476
  • 1
  • 4
  • 7
33
votes
3 answers

Is there any real value in unit testing a controller in ASP.NET MVC?

I hope this question gives some interesting answers because it's one that's bugged me for a while. Is there any real value in unit testing a controller in ASP.NET MVC? What I mean by that is, most of the time, (and I'm no genius), my controller…
LiverpoolsNumber9
  • 788
  • 1
  • 6
  • 13
31
votes
5 answers

Should we use Entity Framework?

We currently have the following stack : VS 2005 Web forms SQL Server 2005 IIS 6 We are planning on transitioning to this : VS 2010 MVC and Web Forms SQL Server 2008 IIS 7 My question is, when we move to MVC with VS 2010, should we use Entity…
FarFigNewton
  • 525
  • 1
  • 4
  • 11
1
2 3
37 38