• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2454
  • Last Modified:

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.
0
ChiBella
Asked:
ChiBella
  • 2
1 Solution
 
ChiBellaAuthor Commented:
Yes...and I also cannot update a label which is outside of the updatepanel.
0
 
nmarunCommented:
Did you go through the link? It details on how to avoid this error.

See if you can move the label inside the update panel.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now