Posts

Slowly zoom google map on marker double click

Add marker then double click event for the marker  var marker = new google.maps.Marker({                                     position: location,                                                                        map: map,                                     title: sname                                 });                                 google.maps.event.addListener(marker, 'dblclick', function (event) {               ...

Simple API that receive MultipartData File with parameter in ASP.net Web API

This article demonstrate how to create a Asp.net web API that receive file with parameter also get file name  , content type and extension      using  System; using  System.IO; using  System.Linq; using  System.Net; using  System.Net.Http; using  System.Text; using  System.Threading.Tasks; using  System.Web; using  System.Web.Http; namespace  LetstrackAPI.Controllers {      public   class   UploadFileController  :  ApiController     {         [ HttpPost ()]          // [AllowAnonymous]          public   async   Task < object > PostFile()         {              // Check if the reque...

How to call/Consume post API with Header in C#

This is simple sample code written to consume post API which has header   Here I am using newtonsoft dll to convert class into json     //using Newtonsoft.Json     private void PostWithHeader()     {         WebRequest req = null ;         WebResponse rsp = null ;         string url = "http://" ; // Pass url here         string API_Response = "" ;         jsonParameter P = new jsonParameter () { userid=1};         try         {             req = WebRequest .Create(url);             //Uncomment below line if Post with Basic auth also ...

Multipart/form-data using basic auth

// Implements multipart/form-data POST in C# http://www.ietf.org/rfc/rfc2388.txt // http://www.briangrinstead.com/blog/multipart-form-post-in-c public static class FormUpload {     private static readonly Encoding encoding = Encoding.UTF8;     public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, object> postParameters)     {         string formDataBoundary = String.Format("----------{0:N}", Guid.NewGuid());         string contentType = "multipart/form-data; boundary=" + formDataBoundary;         byte[] formData = GetMultipartFormData(postParameters, formDataBoundary);         return PostForm(postUrl, userAgent, contentType, formData);     }     private static HttpWebResponse PostForm(string postUrl, string userAgent, string contentType, byte[] formData)     { ...