vincenthandle
Programmer
Hello,
I have created a Web Part using an web service to gather some data. I made it possible to change the web service url for the user, using the Tool Bar properties (modify webpart option). Ofcourse it is possible the user enters an invalid url so I have handled all expected exceptions, those I throw from the objectdatasource (which is calling the web service) and catch it on databinding as an TargetInvocationException, this works perfectly when the webpart is used properly.
Here is my problem, when you add the webpart, using a wrong url (when you add it the first time and a valid url is not set) AND when you close the webpart on the sharepoint page, using a wrong web service url, it will crash to the default ASP error page (Server Error in '/' Application.) telling me:
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message: The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators.
This is exactly the exception I receive in my catch area and is handled properly when u use the webpart normally, however the datasource is called when you close the webpart on the page and no error is handled. I Stepped through it, I even override every Page Life Cyle Event and make a try/catch around the base.OnPreRender(e) etc (and its internal code, produced by me). The error is nowhere catched and thrown as and error, making sharepoint crash. When you reload sharepoint, the web part is not closed when you closed it, when you added the webpart the webpart is added and will now show the user friendly error catched and created by me.
Has anyone had this problem before or do you know the solution, I will be very pleased!
If you need more information I will try to provide it.
Thanks in advance
I have created a Web Part using an web service to gather some data. I made it possible to change the web service url for the user, using the Tool Bar properties (modify webpart option). Ofcourse it is possible the user enters an invalid url so I have handled all expected exceptions, those I throw from the objectdatasource (which is calling the web service) and catch it on databinding as an TargetInvocationException, this works perfectly when the webpart is used properly.
Here is my problem, when you add the webpart, using a wrong url (when you add it the first time and a valid url is not set) AND when you close the webpart on the sharepoint page, using a wrong web service url, it will crash to the default ASP error page (Server Error in '/' Application.) telling me:
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message: The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators.
This is exactly the exception I receive in my catch area and is handled properly when u use the webpart normally, however the datasource is called when you close the webpart on the page and no error is handled. I Stepped through it, I even override every Page Life Cyle Event and make a try/catch around the base.OnPreRender(e) etc (and its internal code, produced by me). The error is nowhere catched and thrown as and error, making sharepoint crash. When you reload sharepoint, the web part is not closed when you closed it, when you added the webpart the webpart is added and will now show the user friendly error catched and created by me.
Has anyone had this problem before or do you know the solution, I will be very pleased!
If you need more information I will try to provide it.
Thanks in advance