Tuesday, 24 January 2017

Web Service to return data in JSON format

Web services are those services which are available over web to communicate between systems.
By default Web Service returns data in XML format, now if the requirement is to return in JSON format then we need to do modification in web method.

Thursday, 6 October 2016

Query with OData in SharePoint 2013


OData, i.e. Open Data Protocol, which defines a protocol for the querying and updating of data

OData is a REST-based protocol for querying and updating data and is built on standardized technologies such as HTTP, Atom/XML, and JSON.
Microsoft Visual Studio and .NET provide established support for services compliant with the OData specification.

What is OAuth?

OAuth stands for Open Authorization for token based authentication and authorization over web.

OAuth was first introduced in year 2007. In year 2010 OAuth2.0 was introduced.


Wednesday, 28 September 2016

What are Idempotent and Non Idempotent methods?

Idempotent Methods
Lets start by understanding the meaning of Idempotent.
Idempotent means  "unchanged in value following multiplication by itself"

Idempotent HTTP methods are those methods which will not make any modification event after calling multiple times.

Saturday, 24 September 2016

How to create secure Web API in asp.net

In my earlier blog i wrote about how to create a web api in asp.net , now your web api is ready to work.

Web API security is very important specially if you are allowing it to external users to consume it.

Now suppose you want to control your web api in the context of security. How you will achieve this because security is much more needed essentials than any other things in software development.

One way is to use [Authorize] attribute before your controller class like below.
This will disallow the anonymous access for all HTTP verbs implemented in below API.

Sunday, 18 September 2016

SharePoint 2013 Installation step by step


In this blog i will explain about SharePoint 2013 installation on Windows Server 2008 R2, which i did recently on my system.

Below is minimum software requirement for SharePoint 2013 installation.

OS-  Windows Server 2008 R2 (Service Pack1) or above
SQL Server - SQL Server 2008 SP1 or above


Wednesday, 14 September 2016

How do i get ASP.Net Web API to return JSON

ASP.Net web api returns xml by default. But we can change so that it should return JSON instead of XML.

Tuesday, 13 September 2016

How to create ASP.Net Web API

How to create a ASP.Net Web API ?

In this blog I have created ASP.Net web api using Visual Studio 2015.
If you need to know what is web api then please read one of my previous blog.

Friday, 2 September 2016

Thursday, 1 September 2016

MVC Version

MVC was first introduced in .Net 3.5 framework.
MVC 1.0 was available in year 2009 with following features:
Routing, HTML Helpers, Auto Binding. Since then multiple versions were introduced with various .Net framework.

After MVC 1.0, 2.0, 3.0, 4.0, current running MVC 5.0 (MVC 5.2.2 and MVC 5.2.3)

In this tutorial I will be using MVC 5 and IDE will be Visual Studio 2015

Getting started with ASP.Net Web API

Introduction to Web API

ASP.Net Web API is a framework for building, consuming HTTP based service. Advantage of Web API is that it can be consumed over web browse and mobile application as well.

ASP.Net Web API was released with ASP.Net MVC 4. Web API can be used with MVC or normal ASP.Net forms.


Tuesday, 30 August 2016

Angular JS model and controller

Angular JS Model:

ng-model directive in Angular JS is use to bind the value of an HTML control to any variable.

<div ng-app="testApp" ng-controller="testCtrl">
    Name: <input ng-model="name">
    <h1>Hello : {{name}}</h1>
</div>


Monday, 29 August 2016

Google API to authenticate on website using Java Script

In this blog I will explain how you can use Google API to authenticate users using Google Account and allow them to logged in to your own website.

To do this you need to create an App/Project in Google developer dashboard which will allow your website users to authenticate using OAuth.

Sunday, 21 August 2016

Razor View and ASPx in MVC

In MVC 5 we have only one way to create View which is Razor View, file extension of razor view is ".cshtml"
But before MVC 5 we had one more option which was ASPX, now in MVC 5 ASPX has been removed and currently Razor view is available with MVC 5.

There were differences in ASPX and Razor view.
We use @{} to write dynamic code in Razor view and <% %> to write dynamic code in ASPx.

How to pass data from Controller to View:

  • ViewBag
  • ViewData
  • TempData


I will discuss about these 3 ways one by one in next blogs.

My first ASP.Net MVC Program

In all my blog I will be giving example/code in context of Visual Studio 2015.
So first create a MVC project in VS 2015.

File-> New -> Project
Select Web from templates (from left side) and ASP.Net Web Application from middle section, click on OK.

Now select MVC from template section and click on ok. Your MVC project will be created.

You may see some folders in solution explorer with name Models, Views, Controllers

To create MVC project in VS 2015, follow below steps.

Saturday, 20 August 2016

Introduction to ASP.Net MVC

Introduction to ASP.Net MVC

This is my first blog on MVC. So what is the relation between ASP.Net and MVC?

ASP.Net is a framework for developing web applications and MVC (Model View Controller) is an architecture to arrange code in better way.

Thursday, 18 August 2016

Insert record in database using angular js

In this blog I will explain about how we can save data in SQL database using Angular JS.
In this example i have written a web method which is available in .cs file.


Sunday, 31 July 2016

Angular JS Ng-repeat directive


In this blog I will explain about ng-repeat directives in Angular JS. ng-repeat repeats set of HTML.

Saturday, 30 July 2016

Introduction to Angular JS.

Angular JS is Java Script framework introduced by google in 2012 (version 1.0). It is an open source. Angular JS allow developer to write a powerful client side coding. To work with Angular JS just download angular js file from https://angularjs.org and reference it into your HTML, ASPX page.

Upload a file using JQuery and Generic Handler in ASP.Net

In this blog we will learn how to use jquery and generic handler in asp.net to upload a file.
I have used Jquery to call a generic handler to upload a file.

In this blog I have written code which accepts jpg file only and file size should not exceed 10 MB.
You may customize as per your need.