Showing posts with label occur. Show all posts
Showing posts with label occur. Show all posts

Monday, March 26, 2012

Intercept Exceptions

I was wanting to trap Exceptions that occur in a Web Service, adjust the message (make sure stack trace does not get sent (I know about CustomErrors in web.config)) and put the message in a log.

I found out about SoapExtensions and created such, but just was not able to reach any breakpoints. I then read that I wouldn't reach it unless through a Soap request. So I used WebServiceStudio.exe and hit those breakpoints.

Well, when using Atlas, the full exception was being sent without running through the SoapExtension. I assume now that xmlhttp uses Post requests. Then in web.config WebServices node, I cleared the protocols and added only the Soap protocols... interesting thing is Atlas still called the web service and got the thrown error returned. That made me think it used Soap, but it still never hit the SoapExtension.

Could somebody clear up this confusion? I assume there must be a way to globally intercept Web Service errors. For Web Applications, I use global.asax Application_Error.

Nathan

Atlas does not use SOAP. It uses REST and the serialization method is JSON. Atlas has a custom HTTP Handler for .asmx files, which you can see in your wen.config file. When an Atlas script requests a web service, a special query string parameter named "mn" is appended to the url. The server side web service checks the presense of this parameter and and if it is present it uses custom processing bu Atlas otherwise it uses the default web service handler.The normal processing, which you expect when you call a web service like soap extension execution etc. no longer happens because of the Atlas custom handler. The Atlas custom handler directly catches the excpetion from the web service method and reports to the client, when the web service is invoked from an Atlas script. There is only one option currently (may change in future) and that is to handle the exceptions in the web service methods themshelves. I do not think that there is any global exception hooking mechanism you can use for Atlas.

Saturday, March 24, 2012

Invalid postback or callback argument

I keep logging several errors listed below. I have atlas running on my site with update panels on several pages. This error seems to occur if the user uses the browser "Back" button. Is there a way to handle or prevent this error?

Error on Page: /NewestMembers.aspx Error Date/Time: Aug 29, 2006 - 6:57:37 AM Error Message: Invalid postback or callback argument. Event validation is enabled using in configuration or 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. Error Source: System.Web Session Variables: Query String Variables: Form Variables: __EVENTTARGET = ctl00$_MainContentPlaceHolder$_NewestMembersGridView __VIEWSTATE = DaDFsO2NFD857Lj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ogKI1Nm/BgGsGC4mEkx4Zcp1GydtIeXgIhOUI8pTK49CiA4lSUmwpxJdu8en+m2LsgqID+lWCSnIa6mA2SnTihdI10Wg== __EVENTVALIDATION = 2YRA4zH2000xi7Lksp82pi1+tHABGzOHht7Et+u77Weu3g/BHP9mPNIn43W1htX8pl8A+lgBfwaLZ1wEqFInQUSD95SpvsF87mANctA9ZJk= __VIEWSTATEENCRYPTED = ctl00$_MainContentPlaceHolder$ScriptManager1 = ctl00$_MainContentPlaceHolder$_upNew __EVENTARGUMENT = Page$2 __PREVIOUSPAGE = zubEIIwaLs1mi-rZEVX2KuSBbYvdLRKqzF9n-nadHR81 Error Stack Trace: at System.Web.UI.ClientScriptManager.Valid ateEvent(String uniqueId, String argument) at System.Web.UI.Control.Valid ateEvent(String uniqueID, String eventArgument) at System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postD ata) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Hi,

I don't know your scenario but you could try to give a look tothis article by Joteke and see if it could be your case.


All of my pages are using the object datasource. I'm not doing any manual databinding.

Any other ideas out there?

Thanks for your suggestion


I have the same problem.

Here is my scenario. I have an update panel along with an AutoCompleteExtender. I have a DropDownList with an autopost back to make changes to the ContextKey property of the AutoCompleteExtender on SelectedIndexChange. which is causing me to get the post back error.

Any fixes for this?

Thanks,
Kam