Hello,
after upgrading a DNN host to version 6.1.2 a module of mines began giving a bad error when calling __doPostBack() in a javascript function:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
I'd like to solve this without affecting web.config, so I added this function to my module code:
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
Me.Page.ClientScript.RegisterForEventValidation(btnEditZone.UniqueID)
MyBase.Render(output)
End Sub
But nothing changed: I always get that error if I try to call the __dopostpack.
btnEditZone is an asp:button on my page:
<asp:Button ID="btnEditZone" runat="server" style="display:none;" />
The javascript function:
function EditZone(idSellerProfileZone) {
__doPostBack('<%=btnEditZone.UniqueID%>', idSellerProfileZone);
}
Server side, the postback is processed by this function:
Protected Sub btnEditZone_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEditZone.Click
Dim idSellerProfileZone As String = Request("__EVENTARGUMENT")
EditZone(idSellerProfileZone)
End Sub
I don't know if it's possible to modify the @page directive from within my module, but using a Render() function should be a better solution, am I wrong? The render function is called, but the error is still there: can anybody help?
Thank you.
Regards,
al.