.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Google Search API implementation in asp.net Tutorial

Posted By:Nikhil Kumar       Posted Date: February 01, 2010    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  

Google Search API implementation in asp.net. Here is an article to show how to implement or use Google API in Asp.NET.

Google API in ASP.NET

Here is an article to show how to implement or use Google API in Asp.NET.


Using Google API means you are using google searching in your website

First Step:-

For using Google API you should have a Google Account for this just simply create a Gmail Account which is free of cost.

Then you have to get the Google API key this is also free, simply search on google for Google API key.

Secong Step:-

Now create an ASP.Net website and add this code to Defaul.aspx page


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    Google API:


Interface (Defaul.aspx)



using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
  protected void Page_Load(object sender, EventArgs e)
  protected void btn1_Click(object sender, EventArgs e)
  if (txtsearch.Text.Trim().Length == 0)
  lblmsg.Text = "Please enter your query to search...";

Third Step:-

Add a new .aspx page and give the name "SearchResult.aspx".

Fourth Step:-

Add this code to

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SearchDetails.aspx.cs" Inherits="SearchDetails" %>

  Google Search...


NOTE: Add you key here = Copy your key from Google and paste in place of "add your key here"
If you feel any problem in getting Google API key, then contact me I will be happy to help you


When you enter some query in textbox and click the search button it will redirect this page to SearchResult.aspx page where we are using script provided by Google.

Note: When you are getting Google API Key then you have to enter the website name, there you have enter http://www.google.com.


Here we learn how to use Google API in ASP.NET.

Thanks !!!

Nikhil Kumar

 Subscribe to Articles


Further Readings:

Author: menaka         Company URL: http://www.dotnetspark.com
Posted Date: December 01, 2010


How can we get the Google API key? From where can i get it?
Author: rohit         Company URL: http://www.dotnetspark.com
Posted Date: February 09, 2011

i need to used google search api code you mention above i alredy know that but the problem is i need 200 result without paging how i can do this plz reply me thanx

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend