Archivi categoria: .Net

Error HTTPOnly cookies

I found this problem requesting a site by C# Here an interesting link I also invite you to read the documentation that I am quoting here for you: If the server sends HTTPOnly cookies, you should create a System.Net.CookieContainer … Continua a leggere

Pubblicato in .Net, c# | Lascia un commento

Pass json POST data to Web API method and enumerate it

This is a very tricky problem. I had to create a REST service that receives any json class and elaborates its properties and values without knowing anything about the object received. Here the body posted And here the REST service’s … Continua a leggere

Pubblicato in .Net, c#, REST | Contrassegnato , , | Lascia un commento

POST Ajax and redirect file response to the browser

Yesterday a collegue of mine had a problem: How post an ajax form and redirect the file result to the browser. If you post a form to an handler that response with a file the result will be downloaded by … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, MVC | Contrassegnato , , | Lascia un commento

Optimize Entity Framework performance

This wouldn’t be a complete article on how to improve EF performance but only a little reminder. Every time you have performance problem on updating or adding entity these properties will help you. You can find a lot of articles … Continua a leggere

Pubblicato in .Net, Entity Framework | Lascia un commento

Multiple content type

Today I’ve worked on a generic handler that recovers file from else where, than it sends the file to client browser. When you write a generic handler it is important to specify the contentType before complete the response. There are … Continua a leggere

Pubblicato in .Net, HTML5 | Lascia un commento

Serializing Entity Framework classes with JSON (Web API) without relationship

How many times have you ever tried to serialize an object of a type generated by EntityFramework. As you know with Entity Framework the relationship between to tables are made using virtual IEnumerable. As just you try to access to … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, Entity Framework, MVC | Contrassegnato , | Lascia un commento

Missing compiler required member ‘Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create’

If you are working with MS unit test that use dynamics object, you’ll get this error. Missing compiler required member ‘Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create’ to solve it add the reference to Microsoft.CSharp

Pubblicato in .Net, c# | Contrassegnato , , | 2 commenti

The entity or complex type cannnot be constructed in a LINQ to Entities query

In some cases it is necessary read form a table and return a different type. A typical cases is if you read from a base table but you wanna return the view class and not the table class mapped by … Continua a leggere

Pubblicato in .Net, c#, Entity Framework | Contrassegnato | Lascia un commento

MVC Remove error from MiodelState

If you do client side validation, you’ll know that hiding some controller will remove the validation for that controller. But if you need to validate it on server side, the validation will act also in some controller hidded by javascript. … Continua a leggere

Pubblicato in .Net, MVC | Contrassegnato , , | Lascia un commento

WebClient download page error: 403 Forbidden

Today trying to download a web page using WebClient, I have received 403 Forbidden. After some test I found two possible solutions:

Pubblicato in .Net, c# | Lascia un commento