Sunday, March 11, 2012

Login inside UpdatePanel + Master Pages = Sys.Webforms.PageRequestManagerServerErrorExcept

Hi,fromano2802

I am afraid we cannot find out the exact root cause without further information captured when the problem occurs.

To troubleshoot this issue, we really need more source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thank you.


Hi there,

thanks for answering my question. The login page doesn't have any master page, but once authenticated the user will be redirected to a page attached to a master page.

The error message pops up every time I try to log in even if I leave the content part of the master template blank.

Here is the code:

Login page:

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Login.aspx.cs"Inherits="Login" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="inside_wrapper">
<div id="entryBox">
<asp:Login ID="Login2" runat="server" DestinationPageUrl="~/Default.aspx" PasswordRecoveryText="Forgot Password?"
PasswordRecoveryUrl="~/ResetPassword.aspx" TitleText="">
<LayoutTemplate>
<table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse;
width: 300px;">
<tr>
<td>
<table border="0" cellpadding="0" style="width: 300px">
<tr>
<td align="right" style="width: 110px; height: 30px;">
</td>
<td style="height: 30px" colspan="2">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
ValidationGroup="Login2" />
</td>
</tr>
<tr>
<td align="right" style="width: 110px">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" Font-Bold="True">User Name:</asp:Label></td>
<td style="width: 164px">
<asp:TextBox ID="UserName" runat="server" Width="164px" CssClass="textbox"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td align="right" style="width: 110px">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" Font-Bold="True">Password:</asp:Label></td>
<td style="width: 164px">
<asp:TextBox ID="Password" runat="server" TextMode="Password" Width="164px" CssClass="textbox"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 110px">
</td>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="width: 274px; color: red; height: 15px;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></td>
<td>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="Login2" />
</td>
<td>
</td>
</tr>
<tr>
<td style="width: 110px">
</td>
<td style="width: 164px">
<asp:HyperLink ID="PasswordRecoveryLink" runat="server" NavigateUrl="~/ResetPassword.aspx">Forgot Password?</asp:HyperLink>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>

</body>

Master template:

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeFile="Default.master.cs"

Inherits="DefaultMaster" %>

<%@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Namespace="System.Web.UI"TagPrefix="asp" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head"runat="server">

<title/>

</head>

<body>

<formid="mainForm"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">

</asp:ScriptManager>

<divid="mainwrapper">

<divid="header">

NTDMS

<divid="header-bottom"style="text-align: right">

<asp:LoginViewID="LoginView1"runat="server">

<LoggedInTemplate>

You are logged in as<asp:LoginNameID="LoginName1"runat="server"/>

</LoggedInTemplate>

<AnonymousTemplate>

You are not logged in yet.

</AnonymousTemplate>

</asp:LoginView>

<asp:LoginStatusID="LoginStatus1"runat="server"/>

</div>

</div>

<tableid="content"border="0">

<tr>

<tdid="content-left"valign="top">

<asp:TreeViewID="NavigationTreeView"runat="server"ExpandDepth="2"DataSourceID="ApplicationSiteMap"/>

</td>

<tdid="content-right">

<divid="breadcrumb">

<asp:SiteMapPathID="DefaultBreadCrumb"SiteMapProvider="DefaultSiteMapProvider"runat="server"/>

</div>

<asp:ContentPlaceHolderID="DefaultContent"runat="server"/>

</td>

</tr>

</table>

</div>

<asp:SiteMapDataSourceID="ApplicationSiteMap"runat="server"SiteMapProvider="DefaultSiteMapProvider"ShowStartingNode="False"/>

</form>

</body>

</html>

Thank you for helping me with this.

fromano2802


Hi there,

thanks for answering my question. The login page doesn't have any master page, but once authenticated the user will be redirected to a page attached to a master page.

The error message pops up every time I try to log in even if I leave the content part of the master template blank.

Here is the code:

Login page:

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Login.aspx.cs"Inherits="Login" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title></title> </head>

<body>

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="inside_wrapper">
<div id="entryBox">
<asp:Login ID="Login2" runat="server" DestinationPageUrl="~/Default.aspx" PasswordRecoveryText="Forgot Password?"
PasswordRecoveryUrl="~/ResetPassword.aspx" TitleText="">
<LayoutTemplate>
<table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse;
width: 300px;">
<tr>
<td>
<table border="0" cellpadding="0" style="width: 300px">
<tr>
<td align="right" style="width: 110px; height: 30px;">
</td>
<td style="height: 30px" colspan="2">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
ValidationGroup="Login2" />
</td>
</tr>
<tr>
<td align="right" style="width: 110px">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" Font-Bold="True">User Name:</asp:Label></td>
<td style="width: 164px">
<asp:TextBox ID="UserName" runat="server" Width="164px" CssClass="textbox"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td align="right" style="width: 110px">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" Font-Bold="True">Password:</asp:Label></td>
<td style="width: 164px">
<asp:TextBox ID="Password" runat="server" TextMode="Password" Width="164px" CssClass="textbox"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 110px">
</td>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="width: 274px; color: red; height: 15px;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></td>
<td>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="Login2" />
</td>
<td>
</td>
</tr>
<tr>
<td style="width: 110px">
</td>
<td style="width: 164px">
<asp:HyperLink ID="PasswordRecoveryLink" runat="server" NavigateUrl="~/ResetPassword.aspx">Forgot Password?</asp:HyperLink>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>

</body>

Master template:

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeFile="Default.master.cs"

Inherits="DefaultMaster" %>

<%@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Namespace="System.Web.UI"TagPrefix="asp" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head"runat="server">

<title/> </head>

<body>

<formid="mainForm"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">

</asp:ScriptManager>

<divid="mainwrapper">

<divid="header">

NTDMS

<divid="header-bottom"style="text-align: right">

<asp:LoginViewID="LoginView1"runat="server">

<LoggedInTemplate>

You are logged in as<asp:LoginNameID="LoginName1"runat="server"/>

</LoggedInTemplate>

<AnonymousTemplate>

You are not logged in yet.

</AnonymousTemplate>

</asp:LoginView>

<asp:LoginStatusID="LoginStatus1"runat="server"/>

</div>

</div>

<tableid="content"border="0">

<tr>

<tdid="content-left"valign="top">

<asp:TreeViewID="NavigationTreeView"runat="server"ExpandDepth="2"DataSourceID="ApplicationSiteMap"/>

</td>

<tdid="content-right">

<divid="breadcrumb">

<asp:SiteMapPathID="DefaultBreadCrumb"SiteMapProvider="DefaultSiteMapProvider"runat="server"/>

</div>

<asp:ContentPlaceHolderID="DefaultContent"runat="server"/>

</td>

</tr>

</table>

</div>

<asp:SiteMapDataSourceID="ApplicationSiteMap"runat="server"SiteMapProvider="DefaultSiteMapProvider"ShowStartingNode="False"/>

</form> </body>

</html>

Thank you for helping me with this.

fromano2802


Hi fromano,

Login control can't place inside the update panel and same goes to the fileupload control, this is because of some javascript conflict wit asynpostback in the update panel, i just read it from a book.


Hi giox,

thank you for answering. According to other posts, if you transform the login control to template and turn off the client scripting it should work. Even Microsoft doesn't say that this configuration (login + update panel) is not supported. If the problem is the one you are telling me, I hope they fix it soon.
Out of curiosity what is the book where you read it from?

Cheers,
fromano2802


hi fromano,

After i refered back the book, i'm sorry that i said wrongly in the previous post,the book said putting login part into the updatepanel does not help much since the login part also done by client scripting...mayb you are right about what u said...really sorry bout the mistake.

And the book is a Taiwan published asp.net ajax book, a chinese book =)

No comments:

Post a Comment