C#, Cross Domain, HTML5, JavaScript, NodeJS

Visual Studio Code – A Cross Platform Code Editor built with Chromium

Microsoft has launched VSCode few weeks back for Cross Platform (Linux/Mac,Windows) and 55% download was Non-Windows. Shocking , right ?

HackerNews had a post on this and had really lot of comments/traffic on it.

Lets see the first look of Code.

Code First Look

Code First Look

Its lightweight and simple and has GIT embedded with this.

But I am not here to say that Code has been released by Microsoft. I am here to shock you little bit.

When you are on Code, Just press F12.

And lets see the below image.

Code First Look Shocked

Code First Look Shocked

#%$#@ ???? Is it Chrome Dev Tools ?

YES !!! It is!

In fact VSCode has been built with Web Technologies like HTML,CSS , JavaScript with Chromium and NodeJS . Here , Chromium is the Engine for Chrome browser by Google.

Lets get a little idea about CEF (Chromium Embedded Framework)


And they used Electron for Cross Platform . Electron helps to Build cross platform desktop apps with web technologies Formerly known as Atom Shell. Made with Love by GitHub.

Initially developed For GitHub’s Atom editor , Electron has since been used to create applications by companies like Microsoft, Facebook, Slack, and Docker.

Slack‘s new Desktop app was also built with this.

In VSCode , what we do Like adding/editing Projects/Folders/Files , all is saved in HTML5’s Client Side DBs like IndexedDB and LocalStorage. To know more about HTML5 Database , you can see my other posts on HTML5 Database here


Lets see the below image.

HTML5 Database

HTML5 Database

Okay , lets see Where the World goes to!



(adsbygoogle = window.adsbygoogle || []).push({});


Gravatar – Get avatar by email in C# and check available or not

gravatar.com is very popular now a days. So many large sites use this feature . I needed this feature in one of my working projects

But I needed to check also that email exists in Gravatar or not. If Gravatar does not have that email Id of the user , The app will show its custom Image . But If we call the Gravatar API , Gravatar sends a default image if that email is not available which was not our app’s behavior , so I needed to track and validate that.

UTF8Encoding encoder = new UTF8Encoding();
            MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
            byte[] hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(email));
            StringBuilder sb = new StringBuilder(hashedBytes.Length * 2);
            for (int i = 0; i < hashedBytes.Length; i++)
            var imageHashCode = sb.ToString().ToLower();
            string gravatarImageUrl = "http://www.gravatar.com/avatar/" + imageHashCode + "?d=404";
            var uri = new Uri(gravatarImageUrl);
            using (WebClient client = new WebClient())
                    var imageByte = client.DownloadData(uri);
                    var headers = client.ResponseHeaders;
                    if (headers != null && headers["Content-Disposition"] != null)
                        var header = headers["Content-Disposition"];
                        if (header.Contains(imageHashCode))
                            MemoryStream memoryStream = new MemoryStream(imageByte);
                            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(memoryStream);
                            BitmapSource image = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                            return image;
                catch (Exception ex)
                    return null;
                return null;

Check the URL generation part in the code , I have used ?d=404 . This is the main thing which does the trick so that it returns 404 if that email address does not belong to Gravatar

But if anyone needs the default behavior of Gravatar , then just remove ?d=404 from the URL . It will show the default image if the email is not available.

Hope , this helps.



RDLC : Web.config Settings for ReportViewer

We, .Net Developers always do many kind of reports using RDLC . But while developing , we get the below error If we do not add web.config entries correctly .

We may get runtime error like below :::

The Report Viewer Web Control HTTP Handler has not been registered in the application’s web.config file

add name=”ReportViewerWebControlHandler” preCondition=”integratedMode” verb=”*” path=”Reserved.ReportViewerWebControl.axd” type=”Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”

To resolve this issue , add these below Nodes to Web.Config.

      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />



      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler,   Microsoft.ReportViewer.WebForms, Version=,   Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"  />

Cheers 🙂