Integrate LinkedIn with ASP.Net

Steps to Integrate LinkedIn with ASP.Net is given below.

1)Create an Application in LinkedIn Developer site using the following URL.

Log In with LinkedIn login ID and CreateApp to get the API key and API Secret key for the application.

Generated API and Secret key for LinkedIn

Generated API key







2)Add generated keys in the code and add a reference to the DLL of LinkedIn API.

Download DLL for LinkedIn API here

3)A Login button will be displayed when you run the application.

LinkedIn LogIn Button





4)Once the user authorized the application and grants access to his profile and account details, a call is made to Fetch method of ASPSnippets LinkedIn API to get Name,LinkedInId,Location and Email Address as DataSet. This is done through ASPSnippets LinkedIn API and LinkedIn OAUTH API.

Aspx Code

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
                Linked API Integration
            <asp:Button ID="Button_LinkedIn" Text="Login with LinkedIn" runat="server" OnClick="Button_LinkedIn_Click"/>
            <asp:Panel ID="pnlDetails" runat="server" Visible="false">
                <br />
                <asp:Image ID="imgPicture" runat="server" /><br />
    <asp:Label ID="lblName" runat="server" /><br />
    <asp:Label ID="lblLinkedInId" runat="server" /><br />
    <asp:Label ID="lblLocation" runat="server" /><br />
    <asp:Label ID="lblEmailAddress" runat="server" /><br />


C# Code

protected void Page_Load(object sender, EventArgs e)
           string APIKey = ConfigurationManager.AppSettings["APIKey"];
           string APISecret = ConfigurationManager.AppSettings["APISecret"];
           LinkedInConnect.APIKey = APIKey;
           LinkedInConnect.APISecret = APISecret;
           LinkedInConnect.RedirectUrl = Request.Url.AbsoluteUri.Split('?')[0];
           if (LinkedInConnect.IsAuthorized)
               pnlDetails.Visible = true;
               DataSet ds = LinkedInConnect.Fetch();
               imgPicture.ImageUrl = ds.Tables["person"].Rows[0]["picture-url"].ToString();
               lblName.Text = ds.Tables["person"].Rows[0]["first-name"].ToString();
               lblName.Text += " " + ds.Tables["person"].Rows[0]["last-name"].ToString();
               lblEmailAddress.Text = "";
               lblLinkedInId.Text = ds.Tables["person"].Rows[0]["id"].ToString();
               lblLocation.Text = ds.Tables["location"].Rows[0]["name"].ToString();
               imgPicture.ImageUrl = ds.Tables["person"].Rows[0]["picture-url"].ToString();

       protected void Button_LinkedIn_Click(object sender, EventArgs e)




Demo Code