Hi,
I did some invesitgation on the"Unknown Error" javascript popup and it does happen when the session expires and the user performs an operation on the page. I am not able to get rid of this problem, eventhough the code checks for session expiry. The page doesn't load in the first place to call the function given below. Instead the unknown error popup appears . We are looking for a fix as soon as possible as we are going live next month . This is critical as almost all the web pages in the application is using atlas updatepanel. Can anyone please provide a solution to this problem.
Thanks in Advance,
Vikram
Session Expiry Server Side Code:
privatevoid CheckSessionExpiry(){
string appPath = Request.ApplicationPath;if (appPath !="/")appPath = appPath +
ConfigurationManager.AppSettings["SessionExpiryPage"];elseappPath =
ConfigurationManager.AppSettings["SessionExpiryPage"];string headerval =Convert.ToString((Session.Timeout * 60) - 45) +";URL=" + appPath;Response.AppendHeader("Refresh", headerval);if (Session["sUserID"] ==null){
Response.Redirect(appPath);
}
}
Unfortunately, there's no adequate solution. I'm facing the problem myself and I wonder when it's going to be fixed. You can browse through the forum to see I'm right.If you are using other Java-Script functions on your page, I have found it matters if you have your SCRIPT tag with language=javascript or language="javascript" and if it is the HEAD of your HTML or in the BODY of your HTML.
If in the HEAD of your HTML, I have found that you need to have the double quotes [ language="javascript" ]
If in the BODY of your HTML, double quotes do not seem to matter, with or with out double quotes seems to work just fine.
For more detail:
http://jblack.wordpress.com/2006/08/18/javascript-or-javascript/
Hi,
Thanks for your reply. But unfortunately I do have language="javascript" . So what else could be the problem .
We use simple javascripts for doing some client side validations. Could they sometimes cause atlas to give raise to unknown error problem ?
Example 1:btnCompareBenefits.Attributes.Add("onclick", "return CompareClick();"); CompareClick function is in a .js file.
Example 2:deleteButton.Attributes.Add("onclick", "return confirm (\"Are you sure you want to Delete? \");");
Thanks in Advance,
Vikram
Hi All,
I am also experiencing an issue where I get unknown error.
My issue only happens when I wrap asp.net 2.0 controls in an update panel. The strangest thing is that this is only happening in one of two projects that uses the same ASP.net controls. In one I get the updates working fine in the other I get unknown error. The only difference as I can see is that n the project that doesn't work correctly the controlls are nested more deeply. I have a panel surrounding a header and body panel, giving the appearance of a window and the update panel is inside the body panel so the controls are 3 panels deep in design mode. In the project where it all works the controls are one panel deep only as they are inside an update panel only.
I have tried th javascript "javascript" fix as well and the ampersand fix and validaterequest="false" in the page tag... none work, the only way to stop the error is to avoid placing any asp.net control inside an update panel.. Then I get a postback :0(
This issue is crippling us at the moment.
My issue was totally the reverse! I have an ScriptManager on my masterpage. The "Unknown Error" popup was occuring on a page with no UpdatePanel. When I wrapped the asp.net 2 control on the page in an UpdatePanel the popup went away.
Bump.
I am also having this problem
I had this issue as well. I did find an acceptable work arround. Create and<ErrorTemplate> section within the ScriptManager tag. This will eliminate the JavaScript popup alert. Then you can have a firendly erro message asking the user to relogin and provide a link to the login page. Something like this:
<atlas:ScriptManagerID="ScriptManager1"EnablePartialRendering="true"OnPageError="Page_ErrorHandler"runat="server">
<ErrorTemplate>
<divclass="ErrorDialog">
<div>
<asp:ImageID="Image1"ImageUrl="~/images/error.gif"ImageAlign="AbsMiddle"runat="server"/>
<spanstyle="font-size: 16pt; font-weight: bolder;">Server Error</span>
</div>
<div>
You encountered an unexpected error. The error has been logged and will be investigated.
</div>
<div>
<ahref="login.aspx">click here to re-login.</a>
</div>
</div>
</ErrorTemplate>
</atlas:ScriptManager>
See ErrorTemplate doc for more info:http://atlas.asp.net/docs/Server/Microsoft.Web.UI/ScriptManager/P_ErrorTemplate.aspx
Hope this helps,
Perry
Remove lineResponse.AppendHeader("Refresh", headerval); & try again with correct session timeout methods.
remove any response.write statements & replace them with this.page.clientscript.registerclientscriptblock();
we have no problems with session timeout.Updatepanel works even if session is expired
Amit Lohogaonkar
mcp,mcad
lohogaonkaramit@.yahoo.com
Hi,
I have found this problem several times. finally I was able to corner it in my case.
I was using several UpdatePanels on my page and have few javascript functions within SCript tag in HEAD section of page.
It is important to note that whnever javascript function contains "postfix increment operator" i.e ++ or "postfix decrement operator" i.e. --, it will throw "Unknown Error".
Similarly whenever javascript function contains "logical AND operator " i.e. && "logical OR operator" i.e. ||, it throws the "Unknown Error".
However, if these functions are inside "BODY" tag then it works just great. Or if they are moved to a separate JS file and then include it in HEAD tag, it all works fine.
Hope this helps.
Mayur
Hi
still face same problem,
Regards,
Sarfaraj Sayyad
I'm guessing you guys are using ASP.NET Forms Auth - and the login cookie is expiring.
From what I can tell, ASP.NET Ajax throws an "Unknown Error" when it makes a XmlHttp call and gets a response which isn't what it was expecting.
In the case of a session expiry, instead of the page fragment it was expecting it suddenly gets back a "You need to login" page, or a 500 error, or a 404.
It doesn't know what to do, and dies with an "Unknown Error".
I'm going to try out that ErrorTemplate example pasted in one of the replies above and see if that does it for me.
I'm also getting the same 'Unknown error' alert when the session expires. Without Atlas on the page there is no problem. I can trap errors and modify the ErrorMessages of other page errors with with the 'OnPageError' event of the script manager but it won't trap the 'Unknown error'. I assume this is because the server code is not executed as Atlas is not able to deal with the expired session. My page continues after the alert and renews the session but I would like to avoid this error or at least be able to modify it.
I've discovered since my last post that the "Unknown error" only occurrs when the new session trys to redirect to a different page. In my app when the session starts it checks certain conditions and may redirect. If there is no redirect it renews the session without error.
I'm facing the same problem.
As I'm not using any other client side javascript than the one built in the atlas controls I can eliminate script specific error reasons.
No comments:
Post a Comment