Archivi categoria: c#

Error HTTPOnly cookies

I found this problem requesting a site by C# Here an interesting link https://www.owasp.org/index.php/HttpOnly 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

Store Dictionary object in config file

I found lots of solutions to solve this problem but I didn’t like many of them. In this link I found THE solution: http://stackoverflow.com/questions/338242/how-do-i-store-a-dictionary-object-in-my-web-config-file To avoid to lose it in the future I’ve reported it as well: How to use … Continua a leggere

Pubblicato in c# | 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

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 , , | 1 commento

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