Hot answers tagged

28 votes
Accepted

Benefits of using separate API and UI servers for Web application

One reason is security - if (haha! when) a hacker gains access to your front-end webserver, he gets access to everything it has access to. If you've placed your middle tier in the web server, then he ...
gbjbaanb's user avatar
  • 48.5k
26 votes
Accepted

What are the differences between .NET Framework, ASP.NET, .NET Core, ASP.NET Core and .NET Standard?

.NET Framework is a VM, a JIT compiler, an object memory system consisting of a memory allocator and a garbage collector, a loader, a linker, and a runtime system (collectively called the Common ...
Jörg W Mittag's user avatar
25 votes
Accepted

ASP.NET Projects using too much .NET Boilerplate Libraries / Code

When you start a project and have a particular need, you have a choice: Either you implement your own solution from scratch, Or you use an existent library or framework. When implementing your own ...
Arseni Mourzenko's user avatar
23 votes
Accepted

Isn't CQRS overengineering?

Is CQRS a relatively complicated and costly pattern ? Yes. Is it over-engineering ? Absolutely not. In the original article where Martin Fowler talks about CQRS you can see a lot of warnings about not ...
Machado's user avatar
  • 4,100
22 votes
Accepted

What data should a repository return

And knowing (correct me if I'm wrong) that a repository shouldn't return a DTO Theoretically, every layer (= project in your solution) should have its own DTO objects. In that sense, your ...
Flater's user avatar
  • 47.7k
21 votes
Accepted

Difference between 3-Tier architecture and MVC (Model, View Controller) in ASP.Net

This is like asking what the difference is between an apple and an apple core. These two architectures aren't replacements for one another. I think a more accurate view is that the 3-tier architecture ...
Greg Burghardt's user avatar
21 votes
Accepted

Why do Microsoft's libraries depend on Newtonsoft.Json?

The most direct quote I've found is part of Scott Guthrie's announcement of the MVC 4 roadmap, back in 2012, (apparently offline but available via the Wayback Machine) which contains the following ...
Avner Shahar-Kashtan's user avatar
21 votes
Accepted

Why would anyone use multipart/form-data for mixed data and file transfers?

multipart/form-data is a construct created for HTML forms. As you've discovered the positive of multipart/form-data is the transfer size is closer to the size of the object being transferred--where in ...
Samuel's user avatar
  • 9,167
21 votes
Accepted

Is CQRS/MediatR worth it when developing an ASP.NET application?

I think you're expecting too much of the pattern you're using. CQRS is specifically designed to address the difference in model between query and commands to the database, and MediatR is just in-...
Samuel's user avatar
  • 9,167
15 votes

Should I check for software on a users machine via a web browser?

You cannot check through a browser if the user have other software like Word installed. If that was possible it would be a huge security hole.
JacquesB's user avatar
  • 57.8k
14 votes
Accepted

Where to put the Angular app in a ASP.NET Web API solution?

You have two options. Create separate mywebsite.api and a mywebsite.app projects in your solution. Advantages Proper separation of concerns. You can deploy updates to your api and your front end ...
CountZero's user avatar
  • 256
12 votes

Can a caller abort an execution of code invoked by HTTP request?

HTTP doesn't work like that. The client sends a request, then the server sends a response back. No other communication occurs. Well, the server can send 1xx informational responses before the main ...
amon's user avatar
  • 133k
12 votes

Is it a bad practice to use Singleton for DI in Asp.net rather than Scoped, Transient whenever possible?

Is it a bad practice to use X whenever possible? Yes. It is bad practice to turn off your brain and lean on absolutes. It's far better to understand why. So lets step back from that framework and try ...
candied_orange's user avatar
11 votes

Time zone conversions on back-end or front-end

The general rules is 'Always send date times as UTC' and only convert on the presentation layer. However, javascript is rubbish with datetimes. So I would do the required conversion server side and ...
Ewan's user avatar
  • 72.4k
10 votes

Is CQRS/MediatR worth it when developing an ASP.NET application?

CQRS is more of a data management thing rather than and doesn't tend to bleed too heavily into an application layer (or Domain if you prefer, as it tends to be most often used in DDD systems). Your ...
jleach's user avatar
  • 2,652
10 votes
Accepted

Application_Start() vs ApplicationStart()

This is an event handler, in addition to being a method. The convention for naming event handlers is EventOrigin_EventName(...). Event origin can be a name of an instance (camel case), or a name of a ...
Nick Alexeev's user avatar
  • 2,504
10 votes
Accepted

Why is it bad to map between a Model and a ViewModel in an extension method

It isn't how extension methods are supposed to be used, it is not in the spirit of extension methods. I'm going to hard counter that notion, because it is exactly the spirit of extension methods. ...
Flater's user avatar
  • 47.7k
9 votes

Utility Classes in MVC - ASP.NET

None of the answers previously given address the actual question. user60812 simply asked where one would place a utility class inside of an MVC project. Everyone harked on the singular example and ...
Spencer Sullivan's user avatar
9 votes
Accepted

Never using Models, only ViewModels

Would my Data project be considered the "Model" for my application? Yes, that's exactly what Model is supposed to be. Is this a right approach I believe it is. or could there be potential ...
Euphoric's user avatar
  • 37k
9 votes

How Common/Acceptable is it for a .NET developer to abstain from WebForms as a rule?

My observation is that WebForms is on the decline. There is a good reason for that. Having used WebForms extensively in the past, it's difficult to do something outside the box. In addition to the ...
Kasey Speakman's user avatar
9 votes
Accepted

why controller lifetime is transient by default in asp.net core?

There's a number of advantages to transient controllers. I cannot tell you whether any of them were the reason they were done that way - speculating about the intent of designers does not make a good ...
Sebastian Redl's user avatar
8 votes
Accepted

Migrate business logic from database into the business layer (.NET technology)

Be careful! If I understand you correctly, what you describe is going to be a lot slower. Aggregate operations like Sum, Avg etc. is pretty fast if you run them in SQL. They will only be slow if ...
JacquesB's user avatar
  • 57.8k
8 votes

Colleague wants web apps to behave like Windows desktop programs

User expectations should be taken into account when developing software but users are bad sources of UX/UI specifications. You need to have (or be) a UX/UI designer to design a UI that fulfills the ...
Hans-Martin Mosner's user avatar
8 votes

Is it a bad practice to use Singleton for DI in Asp.net rather than Scoped, Transient whenever possible?

Firstly, you are confusing singletons provided by a DI container with the "Gang of Four" singleton pattern. The latter is a glorified global variable and thus a complete anti-pattern and ...
David Arno's user avatar
  • 39.1k
8 votes

Is it a bad practice to use Singleton for DI in Asp.net rather than Scoped, Transient whenever possible?

Before you change whether a service is Transient, Scoped, or Singleton, do make sure you are not introducing bugs. When something is designed to be thrown away quickly, there might be assumptions ...
Berin Loritsch's user avatar
7 votes
Accepted

Who does what in a Single Page Application?

So, I'm more experienced in PHP and Python but my answers should be valid for ASP .NET too, seen that your questions are more about the MVC structure rather than the language / framework itself. ...
edoardo849's user avatar
7 votes
Accepted

Best Practice for masking Credit Card informations in Web Api 2

"We're logging every http request and response with log4Net." Although im sure this is very useful for developers, its very bad practice and is potentialy illegal. As you have pointed out you are ...
Ewan's user avatar
  • 72.4k
7 votes

Is CQRS/MediatR worth it when developing an ASP.NET application?

I highly recommend you view Jimmy Bogard's NDC presentation on his approach to modelling http requests https://www.youtube.com/watch?v=SUiWfhAhgQw You will then get a clear idea of what Mediatr is ...
DavidRogersDev's user avatar
7 votes

ASP.NET Projects using too much .NET Boilerplate Libraries / Code

Yes, most places I've worked at use some of those libraries. It is tempting to see them as bloat, I for one dislike Entity Framework and tend to 'hand crank' my repositories. But, in fact the ...
Ewan's user avatar
  • 72.4k
7 votes
Accepted

At what point does a microservices architecture become "worth it" vs. a monolithic ASP.NET web application?

As I see it, the size of the application doesn't really have much to do with the microservices pattern. After all, you can always choose to build a few large monoliths or to build a monolith out of ...
Michael's user avatar
  • 6,457

Only top scored, non community-wiki answers of a minimum length are eligible