Prevent "success message checksum content error" when a session is invalid? - session

I've got an error message that crops up in my logs pretty often, "Success message checksum content error" with an error code of apex.success_msg.checksum_content_error. I'm pretty sure I know exactly what's happening, basically:
User loads page 1, which contains a list of things that can be edited
User clicks a link to page 2, which allows them to edit the thing
Clicking Save Changes redirects them back to page 1 with a success message, "Changes to the thing have been saved."
User bookmarks the version of page 1 with the success message encoded in the URL, like "...&success_msg=..."
Tomorrow, user uses this bookmark, but their session has expired, so the success message is no longer valid and they get an error.
Is there anything I can do in Apex to prevent this from happening? I can go to each user that does this and tell them, "Don't bookmark that, bookmark this other URL instead", but I'd rather prevent the problem from happening at all.
About the only thing that comes to mind is a custom error handler that looks for this particular error and redirects to a version of the URL without the &success_msg in it, but I'm not even sure if you can redirect inside an error handler like that.

Related

No ajax action fired after session invalidate

We have a JSF webapp with Primefaces 4.0 and CAS Single Sign On.
When a user requests an ajax action (by clicking a p:commandButton or similar component with ajax=true) after he has lost his session because SSOut in another tab, nothing happens, no response from server or action is triggered.
We need to manage that situation to inform the user that his session is no longer available, by showing a dialog or redirecting him to home or a custom page, but we don't know how.
ajax=false solves the problem, but this is not what we want to do.
No ViewExpiredException is thrown.
EDIT:
We had already read and tried this BalusC's solution without success. No Exception is thrown and Handler has nothing to do. Note that isn't an Expired Session or Invalidated by TimeOut session, is just an explicit session.invalidate caused by Cas Sign Out in another tab.
We also tried javascript jsf.ajax.addOnError() solution, and again nothing to capture.
Only p:ajaxStatus onError event catches something, but no way to identify that particular error. Even overriding ajaxStatus javascript function, error data parameter is undefined...
Also, p:log says "Request return with error:error." but, which error is it? how do we identify it?
We are stuck on this issue...
This has been discussed many times, and as far as know there aren't any out-of-the-box solutions yet. One solution is to add a custom ExceptionHandler as stated in this post.
Another option is to register client error handler using jsf.ajax.addOnError(...), and to handle this exception in it. You might need some server code to add a custom header in case session is invalid, which you would use in error handler to be able to differentiate that specific case from other errors.

Classic ASP Error Handling: Calling a function after an error?

I do maintenance on a classic ASP website that basically has no error handling at all yet. So users see any error message that comes across... Instead, I would like my code to be able to catch any potential error and then fire off an email before redirecting the user to a more friendly error-page.
This website is rather large, and every webpage comes with the same include file at the beginning... So ideally, I would like to set an error handler from the beginning of this include file. I haven't had any luck finding a way to do this without having to go through every page individually having error handling happen at the end of the script... Is there a possible way to code something like this from the include file?:
' Include file contents:
Function MyHandler()
'Code for triggering email goes here
response.redirect "ErrorPage.asp"
End Function
On Error call MyHandler()
Thanks in advance!
I suggest to use Custom Error Pages in IIS (Web Server), if you have access to those. You can redirect different types of errors to different scripts if you like or point them all to a single one and have there the logic for all error codes.
You can catch common errors there and maybe redirect the user to a alternative page/site, or return a specific error message.. I would suggest to use the custom error page also to log the error and some information from the session (e.g. form submit data, query strings, referrer URLs, cookies etc.) in a database and/or send a notification email to some service account to identify specific issues that are occurring and then also have something to go on to actually fix the cause of many of the errors.

Opencart Ajax Error unexpected token <

I'm using OpenCart 1.5.1.3 and having this strange error on Guest Shipping in Ajax. I'm getting the error "Unexpected token <".
I have tried everyting, change the Ajax code, look at the controller, but no luck. You can try it yourself at http://www.biancabonte.nl/shop/. Put something in the cart and checkout Direct instead of registering. Then the problem occurs.
Thanks
This is almost certainly due to an error message being output by your store, which precedes the AJAX JSON content. Check your error logs around the time you made/make the request. While they won't contain the < character since they're not formatted like the ones output by PHP, they will still have the actual message. Your error logs will either be in the SYSTEM > ERROR LOGS in the admin, or in your cpanel/plesk/other control panel under logs usually

No admin data found

I tried to claim "Insight for my website" and i get the error "No admin data found at root webpage http://akcja-nikon.pl/. Insights requires admin data at this root webpage for the specified URL akcja-nikon.pl"
Admin tag data is there, i triple checked it, on both index.php and pickup.php (index redirects to pickup - in case you ask). I've done it almost a hundred times on all my other domains and never had a problem with that. I started having issues last week on this and one more domains.
Debugger scraps weird content for the URL an breaks after the first line on the HTML code
https://developers.facebook.com/tools/debug/og/object?q=akcja-nikon.pl%2Fpickup.php
and flags the error in red "Can't Download: Could not retrieve data from URL."
Any ideas? Maybe some weird Facebook cache?
Admin tag data is there, i triple checked it, on both index.php and pickup.php (index redirects to pickup - in case you ask).
No, it does not.
Your index.php redirects to agegate.php via JavaScript – which the Facebook scraper doesn’t care about.
And calling agegate.php directly, without any cookies set (which the scraper does not care for either), delivers a just an error message,
<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in <b>/home/marketingpic/include-pl.php</b> on line <b>38</b>
together with an HTTP status code 302 Moved Temporarily and a faulty Location header that just says Location: pickup.php. (Faulty, because a fully qualified URL is required as value for a Location header by definition.)
And if I call your pickup.php, again without any cookies, it tries to send me back to index.php again (and again with a faulty Location header).
No idea, what exactly you are trying to accomplish here – but the way you are doing it right now, seems to be quite a nonsense.

Displaying Error Page in WP7 app

Just want to check I have not missed anything obvious. There is no way to Navigate the user to a "ooops something bad has happened" page from the UnhandledException handler is there?
What is everyone else doing
I know I can "handle" the error and popup up messagebox but I would prefer a whole page offering them the oppurtunity to file a bug report.
The samples I have seen simply set the RootFrame directly but I have seen that just makes for a messy UI with what looks like a Page displayed on top of another page
TIA
Pat
If you get an UnhandledException it occurs while your applicaiton is about to be shut down. The best you can do in this situation is warn the user that something went wrong (using a messagebox or similar) but be prepared that this may not be displayed to the user for long, depending on the actual exception.
Rather than try and continue executing application functionality when an unhandled exception occurs, simply save the details of the exception. Then, when the application is next started, display a message to the user to indicate that "the last time that app ran there was a problem". You can also use this opportunity to send exception details to yourself/ your web reporting service so you can analyse the issues and fix/prevent them in a future version.
You can call RootFrame.Navigate(your errorPage) to navigate to your custom error page in the UnhandledException handler.
Basically, using a custom MessageBox to show a nice easy-going error info and providing an button to send bug report is very common. And this article is MSDN pointed out that errorinfo not be a separate page in best practice.

Resources