Wednesday, September 28, 2022

Redirect to different page in ASP.NET C# - meta - or in HTML we can do

  HtmlMeta meta = new HtmlMeta();

                            meta.HttpEquiv = "Refresh";

                            meta.Content = "2;url=StudentList.aspx";

                            this.Page.Controls.Add(meta);

---------------------

redirecting of page from one to another with meta

 protected void btn_cancel_Click(object sender, EventArgs e)

    {

        #region redirectbtmeta

        HtmlMeta meta = new HtmlMeta();

        meta.HttpEquiv = "Refresh";

        meta.Content = "1;url=StudentList.aspx";

        this.Page.Controls.Add(meta);

        #endregion

    }


---------------------- In html we can do

<!DOCTYPE html>

<html>

   <head>

      <title>HTML Meta Tag</title>

      <meta http-equiv = "refresh" content = "2; url = https://kapooryash.blogspot.com" />

   </head>

   <body>

      <p>Hello HTML5!</p>

   </body>

</html>


ref:- https://www.tutorialspoint.com/How-to-automatically-redirect-your-visitors-to-your-new-home-page

No comments:

Post a Comment