Introduction
Begin by adding a using statement for System.text library, since StringBuilder is located in the System.Text namespace. Use StringBuilder to modify a string without creating a new object or concatenating many strings together in a loop.
In this article I will show how to search using Google for a value in a TextBox using ASP.NET.
Complete Program
Search_Value.aspx.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Text;
- public partial class Search_Value : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- string text = string.Empty;
- StringBuilder txtaddress = new StringBuilder();
- txtaddress.Append("https://www.google.com/search?q=");
- if (searchtxt.Text != string.Empty)
- {
- text=searchtxt.Text.Replace(' ','+');
- txtaddress.Append(text+' '+ '+');
- }
- string url = txtaddress.ToString();
- Response.Redirect(url, false);
- }
- catch (Exception ex)
- {
- Response.Redirect(ex.ToString());
- }
- }
- }


Awais SattiPosted Feb 27, 2019, 12:20 PM
But i make APi i want to call my rested Api in our project can you help me ?
Awais SattiPosted Feb 27, 2019, 12:20 PM
Sir My task is How to make Api rested Api web Api and how to call in our UI Or project
Awais SattiPosted Sep 24, 2018, 4:57 PM
Lots of errors
Awais SattiPosted Sep 24, 2018, 4:56 PM
Sir this code is not runing can u tell me how we run this code