Category: C#


Beginners Guide to getting started with Amazon Product Advertising API

This is a beginners guide to consuming the Product Advertising API of Amazon. I will be targeting "ItemLookup" method here. But any other API methods like "ItemSearch", "BrowseNodeLookup", "SimilarityLookup", "CartAdd", "CartClear", "CartGet", "CartModify" should look like a cake walk after this. Pre-requisites: An Amazon AWS (Amazon Web Services) account If you do not have one, ...


WebRequest.GetResponse() throwing SSL secure channel error

Problem Statement: WebRequest.GetResponse() is one of the most common ways we adopt to perform a HTTPWebRequest from our server side. This case was a specific one, although the error appeared to be more generic in nature. In fact it happened only in SharePoint and not in my .Net application. The error observed in the GetResponse() ...


Convert a JSON string into a C# object

There could be scenarios in our project wherein we consume a service which returns back a JSON message. These JSON message is infact a stringified version of an object and are recognized as a simple string format by our server side. Decoding them gets difficult at the first shot. But C# itself has got a ...


Generate JSON string output in C#

This is one of the most widely used and very useful script that you could use in your web services/ WCF services/ Handlers or any place wherein you require a JSON string to be passed to the client/ consumer. We make use of the Serialize method in JavaScriptSerializer class in C# under the following namespace: ...


Convert ‘\\’ to ‘\’ in c#

This post would sound pretty weird to any c# developer. However, a situation i had been in last week forced me to bring this into notice. I had an XML file in which i had node values like 'Requirements Management\XYZ'. I read the XML using XLinq and the c# string looked like 'Requirements Management\\XYZ'. At ...


When Microsoft or Google CDN fails, what should u do?

// Let me tell you one thing, an outage in CDN is very rare. But just in case you don't want to take a risk, go ahead with this fallback mechanism, as suggested by Scott Guru. Microsoft CDN outage for jQuery: <script type="text/javascript" src=""></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/Scripts/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E")); ...


Coma getting added in a textbox, placed inside an update panel, on prefill

Problem: A comma is getting appended to a textbox (textbox needs to be inside an update panel), each time a partial refresh happens in that page. Solution: The issue happened especially when i was populating the textbox, from the query string. Most importantly duplicate entries in the query string.  ex: & val=rrq & id =  & ...