Redirect to google search page in asp.net


Here we will discuss how we can redirect the user to google search page in asp.net. Normally there will be a search box and a button on it. Whenever the user clicks on the button, the user should be redirected to the google page with the search parameter.

Also you can read:
How to return multiple values from a function in sql server 2012?

Steps to create wcf service and host wcf service as windows service in C#.Net

SharePoint 2016 new features

Find the below code:

.Aspx Code:

<asp:TextBox ID=”txtSearch” runat=”server” Height=”30px” Width=”280px” ></asp:TextBox>
<asp:Button ID=”btnSearch” OnClick=”btnSearch_Click” Text=”Search” runat=”server” />

Code Behind Code:

protected void btnSearch_Click(object sender, EventArgs e)
{
string search = txtSearch.Text.Trim()+” site:EnjoySharePoint.com”;

Response.Redirect(“https://www.google.com/search?q=” + search);
}

This will open the google search results page in the same page in your web site. If you want to open in a new tab, then follow: response.redirect in asp.net in new tab.


Hope this post will be helpful.

Check out Best Alternative to InfoPath -> Try Now

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →