How to redirect a page to another page in asp.net

Redirect a page to another page
RedirectExample.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string url = "Image.aspx?";
        url += "ID=" + ListBox1.SelectedValue.ToString() + "&";
        url += "Name=" + Server.UrlEncode(ListBox1.SelectedItem.Text);
        Response.Redirect(url);
        
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>asp.net Redirect example: how to redirect a page to another page in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Red">asp.net Redirect example</h2>
        <asp:Label 
            ID="Label1" 
            runat="server" 
            Text="Select an Item for view Image"
            Font-Bold="true"
            ForeColor="SeaGreen"
            >
        </asp:Label>
        <br />
        <asp:ListBox 
            ID="ListBox1" 
            runat="server" 
            ForeColor="AliceBlue" 
            BackColor="Crimson"
            >
            <asp:ListItem Value="1">Avatar</asp:ListItem>
            <asp:ListItem Value="2">Flower</asp:ListItem>
            <asp:ListItem Value="3">Bird</asp:ListItem>
            <asp:ListItem Value="4">Elephant</asp:ListItem>
            <asp:ListItem Value="5">Fish</asp:ListItem>
            <asp:ListItem Value="6">Forest</asp:ListItem>
        </asp:ListBox>
        <asp:RequiredFieldValidator 
            ID="RequiredFieldValidator1"
            runat="server"
            ControlToValidate="ListBox1"
            Text="*"
            >
        </asp:RequiredFieldValidator>
        <br />
        <asp:Button 
            ID="Button1" 
            runat="server" 
            OnClick="Button1_Click"
            Text="Show Image" 
            Font-Bold="true" 
            ForeColor="HotPink" 
            />
    </div>
    </form>
</body>
</html>
Image.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e) {
        Label1.Text = "Image ID: " + Request.QueryString["ID"];
        Label1.Text += "<br />Image Name: " + Request.QueryString["Name"];

        string imageSource = "~/Images/" + Request.QueryString["ID"] + ".jpg";
        Image1.ImageUrl = imageSource;
        Image1.BorderWidth = 2;
        Image1.BorderColor = System.Drawing.Color.Green;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>asp.net Response.Redirect() example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">asp.net redirect example</h2>
        <asp:Label 
            ID="Label1" 
            runat="server" 
            Font-Size="Large" 
            ForeColor="CadetBlue"
            >
        </asp:Label>
        <br /><br />
        <asp:Image ID="Image1" runat="server" />
    </div>
    </form>
</body>
</html>
More asp.net examples