Error messages on your ASP.Net page

Posted by David Wier on 04/19/10 | Tips and Tricks

Use a Try/Catch block for trapping errors in each section of your code. You also then, include an errors label, in case an error pops up. That way it won’t ever go to that ugly yellow screen all developers (and users) hate:

    try 
    

        
// do your stuff here    
    

    
catch(Exceptionex) 
    

        
lblErrors.Text = "An error has occurred: "+ ex.Message; 
    
}













































0 Comments

COMMENTS

Name:
URL:
Comment:

Comments are disabled for this article.