Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Anti forgery field breaks WebDatePicker
posted

Hi

   I have the following page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DKTest.aspx.cs" Inherits="FMI.WSMplannet.Web.DKTest" %>

<!DOCTYPE html>

<html xmlns="">www.w3.org/.../xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">

<asp:ScriptManager runat="server" ID="scriptmanager1">

</asp:ScriptManager>
<h1>DK TEst</h1>

<ig:WebDatePicker ID="wdp" runat="server" >

</ig:WebDatePicker>

</form>
</body>
</html>

Which works fine. I can click on the arrow on the right of the text box and a little calendar popup displays. 

However when I add in cross-site forgery protection by adding a anti-forgery token and validating it like this. 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DKTest.aspx.cs" Inherits="FMI.WSMplannet.Web.DKTest" %>

<!DOCTYPE html>

<html xmlns="">www.w3.org/.../xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">

<asp:ScriptManager runat="server" ID="scriptmanager1">

</asp:ScriptManager>
<h1>DK TEst</h1>

<ig:WebDatePicker ID="wdp" runat="server" >

</ig:WebDatePicker>
<%= System.Web.Helpers.AntiForgery.GetHtml() %>
</form>
</body>
</html>

and this. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Helpers;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FMI.WSMplannet.Web {
public partial class DKTest : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack) {
AntiForgery.Validate();
}
}

}
}

The date picker fails. It now longer brings up a calendar popup when I click on the right-hand side arrow. 

Parents Reply Children
No Data