Reputation: 1918
I have the following code:
<%@ page title="בחירת מועמדי הליכוד" language="C#"
masterpagefile="~/Site.master" autoeventwireup="true" %> <asp:Content
ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content> <asp:Content ID="BodyContent" runat="server"
ContentPlaceHolderID="MainContent"> <center> <div class="endMsg"> תודה
רבה על השתתפותך ! </div> </center> </asp:Content>
I want to add the meta-tag:
<meta http-equiv="Refresh" content="60; url=http://your.new/url/here" />
How do I write code which is interpreted as that meta-tag?
Edit: Based on a comment, I wrote this code:
public partial class Thanks : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int _refresh_In_Seconds = 5;
HtmlMeta metaKey = new HtmlMeta();
metaKey.Name = "Refresh";
metaKey.Content = _refresh_In_Seconds + "; url=Default.aspx";
Page.Header.Controls.Add(metaKey);
}
}
The redirect doesn't work. Can anyone explain why?
Edit 2:
This is another solution to the problem:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<meta http-equiv="Refresh" content="10; URL=Default.aspx">
</asp:Content>
Upvotes: 2
Views: 6881
Reputation: 20693
You have to use HttpEquiv property of HtmlMeta, so instead of:
metaKey.Name = "Refresh";
put:
metaKey.HttpEquiv = "Refresh";
Upvotes: 0
Reputation: 148524
try this
HtmlMeta metaKey = new HtmlMeta();
meta.Name = "Refresh";
meta.Content = _refresh_In_Seconds + "; url=whatEver.aspx";
Page.Header.Controls.Add(metaKey);
Upvotes: 2