Saturday, September 14, 2013

Suppress Javascript Errors

There are times when we see, due to any reason, our javascript in the page starts throwing errors. Hence if some one is browsing the page using Internet Explorer, they might come across the annoying popups if they have configured the Internet settings like that, this is where this Tutorial might come in handy for a few coders like me tackling the situation.

Again it's not a solution it's just a way to handle and tackle the issues, I would still say if you have time in your hand go through your javascript and get it fixed. This snippet must be used if and only if, you are out of time and options.



I hope it gives peace to someone in need!


Wednesday, September 11, 2013

SharePoint 2014 Conference

Dear All,

Microsoft SharePoint conference is back! You can get the details to register on the following link Details

SharePoint Conference offers a wide variety of presentations, labs, certification testing, Q&A sessions, workshops, and networking events for attendees to build their skills and meet other SharePoint professionals. Along with the best new content, industry trends, and product announcements, SharePoint product managers, engineers, and other experts will be answering questions, giving presentations, and hosting discussions

Sunday, September 8, 2013

Custom Document Library Viewer SharePoint 2013 part 1

Lately I came across an interesting task and was able to successfully deliver it. I know that we have a Custom Library Viewer in SharePoint OOTB. I had a different requirement from the one already present in the SharePoint. I had been asked to develop a Custom Document Library Viewer based on Content Types and also display each of the content type in a separate tab.

So, the requirement was something like that for instance in a document library I have 4 different kinds of content types and there are several items in it. I will have to show 4 different tabs and also display the items in each tab using a grid. Interesting isn't it?!

Yea so this gave birth to a new generic web part based on jQuery tabs, and jQGrid. Which is configurable to use any document library, hosted on any website and user can choose which content types to show for a particular library!

Genius isn't it, alright so stay tuned I will be sharing the implementation details in the next post.

CORS support for ASP.NET Web API


CORS (Cross-Origin Resource Sharing) in an ASP.NET Web API 


I have been facing a dreadful issue "access denied access-control-allow-origin not included in response" error whenever I tried to send an AJAX request. I was able to land my call to the web API service and also checked that the Web API service was returning the correct response with correct headers. Still I was unable to find the solution to it and it really got frustrating.

I followed several tutorials on the web to allow the CORS in web API like:

http://aspnetwebstack.codeplex.com/wikipage?title=CORS%20support%20for%20ASP.NET%20Web%20API

then I found this one

http://blogs.msdn.com/b/carlosfigueira/archive/2012/02/20/implementing-cors-support-in-asp-net-web-apis.aspx

This tutorial here was the most comprehensive one and actually contained everything that we should know about CORS and moved me one step ahead. I was successfully able to send CORS requests on my local machine.

Again this error appeared when I deployed in production and then I had to remove the previous CORS handler. I was back to square one and was really desperate to find a solution because this was happening in production.

Finally, I found the magical lines which did the trick for me. Thanks to http://encosia.com/using-cors-to-access-asp-net-services-across-domains/ article.

<system.webServer>
 <httpProtocol>
  <customHeaders>
   <add name="Access-Control-Allow-Origin" value="*" />
   <add name="Access-Control-Allow-Headers" value="Content-Type" />
  </customHeaders>
 </httpProtocol>
</system.webServer>


I hope it helps someone in need because I definitely know how miserable our life gets if such an issue appears.