问题
My asp.net application has a master page, a content page and a user control.
In the main master page there is a link which displays a fancybox as an iframe. The iframe has a form to login to the page. The iframe is a new masterpage which has the content page of the login which has the user control of the login.
When the user clicks on the button to login the server side checks if the credentials are ok and if not it displays a message. All this with a custom validator.
My problem is that when the user first clicks the button to login it checks ok but if the credentials are not good and the user retypes them i get the following error on firefox
Error: Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: the state information is invalid
for this page and might be corrupted http.../jquery-1.7.2.js
On the masterPage I have
<%-- jQuery --%>
<script src="<%= ResolveClientUrl("~/Template/Scripts/jquery-1.7.2.js") %>"
type="text/javascript"></script>
<%-- jQueryUI --%>
<script src="<%= ResolveClientUrl("~/Template/jqueryui/js/jquery-ui-1.8.21.custom.min.js") %>"
<script type="text/javascript" src="<%= ResolveClientUrl("~/Template/Scripts/jquery.fancybox-1.4.3.min.js") %>">
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$("#LoginLightBox").fancybox({
width: 300,
height: 750,
scrolling: "no"
});
$("#RegistroLightbox").fancybox({
width: 300,
height: 750,
scrolling: "no"
});
});
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
<body id="page1">
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server">
</asp:ScriptManager>
<div >
<li style="display:inline"><a class="labelsTipolinks" id="LoginLightBox" href="Login.aspx?iframe=true">Login</a></li>
<li style="display:inline;color: #C53005;">|</li>
<li style="display:inline"><a class="labelsTipolinks" id="RegistroLightbox" href="RegistroUsuario.aspx?iframe=true">Registro</a></li>
On the content page:
<%@ Register TagPrefix="uc1" TagName="Login" Src="~/Controles/Login.ascx" %>
And finally the user control:
<div style="margin-top: 20px">
<asp:UpdatePanel runat="server" ID="updPanelLoginIncorrecto">
<ContentTemplate>
<asp:CustomValidator ForeColor="Red" OnServerValidate="usuarioExistente_Validation"
Display="Static" Font-Size="Small" runat="server" ID="vldLogin"
ValidationGroup="grupoValidacionLoginUsuario"
Text="<%$ Resources:LocalizedText, MsjError_LoginIncorrecto%>">
</asp:CustomValidator>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnLoginLightbox" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
<div class="tableContent" style="float: right;">
<asp:Button CssClass="button" ID="btnLoginLightbox" Text="Login" runat="server" OnClick="btnLogin_Click"
ValidationGroup="grupoValidacionLoginUsuario" />
</div>
Please help this is going me crazy. I have already try enable eventvalidation set to false, sessions, response.cache.setno... etc but none worked.
EDIT
The line where i get the error is on jquery 1.7.2.js and is on the line that says jQuery.dequeue( elem, type );
EDIT 2
I ended up putting the fancybox as an inline element inside the master but it is not the solution i want. Please help me out!!!!!
回答1:
After weeks of trying, i tried putting type:"iframe" and magically it worked! I have no idea what has to do but now it works :) So the code would be:
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$("#LoginLightBox").fancybox({
type: "iframe",
width: 300,
height: 750,
scrolling: "no"
});
$("#RegistroLightbox").fancybox({
type: "iframe",
width: 300,
height: 750,
scrolling: "no"
});
});
</script>
回答2:
I ran into a similar problem in the past. I believe it deals with having <% %>
in the <head>
on the master page, however I may be mistaken. Replace your master page with this and let me know if it fixes the issue.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script type="text/javascript" src="~/Template/Scripts/jquery.fancybox-1.4.3.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#LoginLightBox").fancybox({
width: 300,
height: 750,
scrolling: "no"
});
$("#RegistroLightbox").fancybox({
width: 300,
height: 750,
scrolling: "no"
});
});
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body id="page1">
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server">
</asp:ScriptManager>
<div>
<ul>
<li style="display:inline"><a class="labelsTipolinks" id="LoginLightBox" href="Login.aspx?iframe=true">Login</a></li>
<li style="display:inline;color: #C53005;">|</li>
<li style="display:inline"><a class="labelsTipolinks" id="RegistroLightbox" href="RegistroUsuario.aspx?iframe=true">Registro</a></li>
</ul>
</div>
</form>
</body>
</html>
来源:https://stackoverflow.com/questions/11783707/the-state-information-is-invalid-for-this-page-and-might-be-corrupted