Visualizzazione post con etichetta Tips & tricks. Mostra tutti i post
Visualizzazione post con etichetta Tips & tricks. Mostra tutti i post

mercoledì 27 gennaio 2016

Using HTTP POST method with Postman

I tried the POSTMAN (https://www.getpostman.com/) for testing my REST web services. It is a good tool and when I used it with the GET method all was ok but with the POST method (I had to upload a photo), some problems occurred because I did not understand how to use the Content-Type parameter. I tried to insert it in the “Headers” tab with other parameters but it did not work.

The solution is to select the form-data option in the “Body” tab, enter a type “File” parameter and then you have to select the file for uploading.



Then if you select the “Generate code snippet” you will see the Content-Type parameter like this:

Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW


Regards!

mercoledì 28 ottobre 2015

Could not load file or assembly or one of its dependencies. (Web application)

C# .NET Framework 4.5.1 - ASP.NET WebApi

In my web application, I use a .NET wrapper assembly that uses others COM libraries and when I start up the application, I receive this message error




I have copied all assemblies and the other libraries in my “bin” folder but the reason is that the COM libraries are not copied in the ASP.NET Temporary Files directory.

The solution is add this element in the web.config file.

<system.web>
    <!-- Sets a Boolean value indicating whether the assemblies of an application in the Bin directory
      are shadow copied to the application's ASP.NET Temporary Files directory. -->
    <hostingEnvironment shadowCopyBinAssemblies="false"/>
</system.web>

Kind regards!

venerdì 3 agosto 2012

Usare Fiddler2 con localhost


Windows 7 64 bit
Ci sono diversi modi per analizzare con Fiddler2 le chiamate fatte su localhost, a questo indirizzo http://stackoverflow.com/questions/826134/how-to-display-localhost-traffic-in-fiddler-while-debugging-an-asp-net-applicati se ne possono trovare alcuni. Stranamente però nessuno di questi metodi funzionava nel mio pc.

Alla fine tra le opzioni di Fiddler2 ho notato questa dialog box

Così nel mio codice c#, utilizzando CodeScales (http://www.codescales.com/) come HTTP client ho aggiunto la seguente riga evidenziata in giallo:
HttpClient client = new HttpClient();
HttpPost postMethod = new HttpPost(new Uri("http://localhost:52056/api/prototype"));
client.Proxy = new Uri("http://127.0.0.1:8888");

ed in questo modo sono riuscito a fare un capture della mia chiamata verso un servizio REST.