C#.NET redirect after 5 seconds
I am created a web based project in C#.NET. On the HOME page, there is a link which calls another webpage using Response.Redirect () function. But there I got the problem. Every time I click on the link the browser waits for 5 seconds and then redirects me to the next page. Does anyone know what and why is happening this?
Re: C#.NET redirect after 5 seconds
Redirect code on your calling page:
Quote:
Response.Redirect("YourPage.aspx");
In the load event of called page that you are redirected to, use the HtmlMeta object to redirect immediately:
Code:
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "Refresh";
meta.Content = "0; URL=Alert.aspx";
Page.Header.Controls.Add(meta);
where the number 0 (immediately) is the number of seconds to wait before redirecting.
Re: C#.NET redirect after 5 seconds
Why don't you use onclick function of javascript rather than using server control button. For the link you can mention something like window.location.href = "website_name"