Showing posts from 2014

we're adding your app click here to cancel sharepoint 2013, Unable to install app for SharePoint

I configured the complete development environment for SharePoint 2013 app development (SharePoint Hosted) as per the recommended approach.
Everything seems to work perfectly fine, after few days when I tried to deploy another app from VS 2013, the app deployment time goes up to 30 mins with error "Unable to install app for SharePoint", and sometimes the deployment timer becomes endless in VS 2013.

When I checked the app status on the target web application it always shows "we're adding your app click here to cancel".

This was too annoying and I can't even redeploy it from VS 2013 as it prompts versioning error.
Finally I was able to resolve it, please preoceed with following steps.

Go to the target web application, and click "Cancel" on the app.

Once it is removed, go to the SharePoint Server on which SharePoint 2013 has been installed.

Go to Windows Services: Windows from Start -> Administrative Tools.
Alternatively you can got to Start -> Run ->…

Session Id changes in ASP.NET MVC on every new page request

I faced and issue in ASP.NET MVC application where the value of SessionID variable changes on consecutive page requests.

The reason is either you don't have a Global.asax file in your solution, or you have a global.asax in your solution without the definition of session end and session start. So the web server actually doesn't take care of session start and end event per application basis, and it generates a new key on every page request.
You should have a Global.asax in your project and it shall have following two functions added:

 protected void Session_Start()
        { }

        protected void Session_End()
        { }

This should work perfectly.......
Enjoy coding!

Generate a Pie Chart at runtime, C#, .NET

We can quickly write a function which returns a Pie Chart at runtime. Assuming that we are making a pie chart for the number of visitors/users from different countries, we will pass System.Data.DataTable as parameter to the function and it shall return a Chart object.

Please add following namespaces to the page/class.

using System.Windows.Forms.DataVisualization.Charting;
using System.Drawing;
using System.Data;

Write the following function to get a Chart as return Parameter. You can pass a Datatable to the funtion with following schema,
Datatable dt (Country Text, Users Int)

Following is the function :

protected internal Chart GetPieChart(DataTable dtChartData)
            Chart pieChart = new Chart()
                Width = 800,
                Height = 800

            ChartArea chartArea1 = new ChartArea();
            Legend legend1 = new Legend() { BackColor = Color.BurlyWood, ForeColor = Color.White, Title = "Countries" };

Managing Crawl Rules in SharePoint 2013

It's very simple to configure crawling rules in SP 2013 as it was in 2010.
Lets have a quick walk through of it. Crawl rules are used to specfiy detailed logic to the crawler while content crawling. There are situations where we don't want to crawl a particular content or we want exceptional content to be crawled inside that. There are many option available.
Prevent content on a site from being crawled. For example, if you created a content source to crawl, but you do not want the search system to crawl content from the subdirectory, create a crawl rule to exclude content from that subdirectory. Crawl content on a site that would be excluded otherwise. For example, if you excluded content from from being crawled, but you want content in the subdirectory to be crawled, create a crawl rule to include content from that subdirectory. Specify authentication credentials. If a si…