.NET Daily

Recommended Resources


Popular Content


Navigation
Tagasp.net core
Featured

Common .NET Exceptions

How to solve: An expression tree may not contain a dynamic operation – ASP.NET Core

Posted on July 6th, 2019.

This type of exception usually happens when you forget to declare in the view the model that you plan to use. In the code of the view, you will see the attributes underlined with a red line, as on the picture from below: The solution for this issue is to specify at the top of the page the model you plan to use: @model TestApp.Models.User

Featured

Microsoft ASP.NET

Issues with Creating Cookies – ASP.NET Core

Posted on February 2nd, 2019.

I have spent quite a few hours in the past two days trying to understand why a very simple block of code for creating a cookie refuses to work in an ASP.NET Core Application. The code is the following: When this code is executed, everything is fine. No exceptions whatsoever. Still, the cookie was not created in the browser. I tested this...

Featured

Web Development

ASP.NET Core. Best way to Keep Variables between Page Requests

Posted on August 19th, 2017.

In case you want to keep variables between page requests, ASP.NET CORE MVC and ASP.NET MVC provides a more elegant solution than the classic ViewState. It is called TempData. The usage of it is pretty straightforward. The example from below shows how I assign a variable to preserve the sort state of a column in a list table:...

Featured

Microsoft ASP.NET

ASP.NET Core and EF: The instance of entity type ‘User’ cannot be tracked

Posted on July 9th, 2017.

This exception caused me to lose a bit more than expected before finding the right solution. That happened even though the ASP.NET team already documented this Entity Framework behavior very well here but, you know, who has time to read that much documentation… So, the full exception message is the following: InvalidOperationException:...

Featured

Microsoft ASP.NET

ASP.NET Core – How to Get and Write values to HTML Inputs outside the scope of a Model

Posted on May 8th, 2017.

When you come from ASP.NET WebForms directly to ASP.NET Core, you’ll see that lots and lots of old practices for getting an adding data into web page forms have changed completely. For example, ASP.NET Core heavily rely on Models for managing form data while on ASP.NET WebForms you were totally in charge of managing that part....