Link to home
Start Free TrialLog in
Avatar of ChiBella
ChiBella

asked on

Response.write exception in try catch statement

Trying to learn how to do exception handling in .net c#. I wanted to just raise an error to the page but get the error below when I try this statement. Can anyone tell me why? How can I simply display the error (preferrably in a message box) on a web form?

 catch (Exception ex)
        {
           Response.Write(ex.Message);
        }  


Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Avatar of nmarun
nmarun
Flag of India image

Avatar of ChiBella
ChiBella

ASKER

Yes...and I also cannot update a label which is outside of the updatepanel.
ASKER CERTIFIED SOLUTION
Avatar of nmarun
nmarun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial