我有以下代码:
<%@ 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>
我想添加元标记:
<meta http-equiv="Refresh" content="60; url=http://your.new/url/here" />
如何编写被解释为该元标记的代码?
编辑:根据评论,我编写了以下代码:
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);
}
}
重定向不起作用。谁能解释为什么?
编辑2:
这是该问题的另一种解决方案:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<meta http-equiv="Refresh" content="10; URL=Default.aspx">
</asp:Content>