Posts

Uploading images using WebApi and JSON

Image
Hi All, I recently had a requirement to create a Web API to work with a mobile phone. I was required to create a method to upload images. So I did it the following way hope you like it. 1) Class Definitions  public class AuthData     {         public string auth_token { get; set; }     }        public class ImageSetData : AuthData     {         public string Name { get; set; }         public List<Image> Images { get; set; }     }     public class Image     {         public string FileName { get; set; }         public string Extension { get; set; }         public byte[] ImageData { get; set; }     } 2) WebApi Method public ReturnMsg SaveFile([FromBody] ImageSetData imageData)         {           ...

WCF Service and TLS 1.2

Hi All, I worked on a WCF Service (.NET 3.5) which consumed an external web service and was working fine. Until recently it started giving the following error. An error occurred while making the HTTP request to {url}.This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case.This could also be caused by a mismatch of the security binding between the client and the server. This made a big issue as the WCF was already being consumed by number of other systems. Later we got to know the external web service was upgraded to use TLS 1.2 and the .NET 3.5 doesn't support TLS 1.2 (.NET 4.5 or greater supports TLS 1.2). So I had to change the version of the .NET version to 4.5 and add the following code to enforce it to use TLS 1.2. And everything started to work the way they used to. 1) .NET 4.6 and above. You don’t need to do any additional work to support TLS 1.2, it’s supported by default. 2) .NET 4.5. TLS 1.2 is sup...

Bilingual Dynamic Survey

Image
Hi Guys, I created a bilingual Dynamic Survey application using ASP.NET. Hope you like it.

Request String Encryption in MVC 5

Image
Hi Guys, This time I had a requirement to Encrypt the request string parameters before passing them to the Controller's method. After referring this  solution , I made this solution I hope you like it. 1) SecurityHelper  public class SecurityHelper     {         public static string Encrypt(string plainText)         {             string key = "jdsg432387#";             byte[] EncryptKey = { };             byte[] IV = { 55, 34, 87, 64, 87, 195, 54, 21 };             EncryptKey = System.Text.Encoding.UTF8.GetBytes(key.Substring(0, 8));             DESCryptoServiceProvider des = new DESCryptoServiceProvider();             byte[] inputByte = Encoding.UTF8.GetBytes(plainText);             MemoryStream mStream ...

Current Weather App using Google Maps and forecast.io

Image
Hi Guys, This time I made a real time whether application which uses the phone's GPS coordinates and Google Map's GPS coordinates to fetch whether information. I hope you will like it.

JQuery Calendar : Ummul Qura and Gregorian

Image
Hi Guys, I had a requirement to create a calendar which lets user select ummul qura and gregorian dates for bootstrap theme. So I found this jquery calendar  and modified it to achieve it. I hope you like it. Javascript <script type="text/javascript">             var calendarHijri,         calendarGreg;     var minHijriYear,             minHijriMonth,             minHijriDay,             maxHijriYear,             maxHijriMonth,             maxHijriDay;     /*Update Panel Fix*/     function pageLoad()     {         //Handle Uniform         if (!jQuery().uniform) {             return;         }   ...

Facebook Login in Apache Cordova using Angular JS

Image
Hi Guys, I wanted to integrate facebook login within mobile apps. I found very useful blog from the internet and managed to do that. Hope you like it. http://blog.brunoscopelliti.com/facebook-authentication-in-your-angularjs-web-app/