Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Error Handling in custom web parts

  Asked By: Nilay    Date: Jan 27    Category: Sharepoint    Views: 1793

Can somebody point me to best guidelines in doing error handling in
custom web parts?



4 Answers Found

Answer #1    Answered By: Taylor Clark     Answered On: Jan 27

Can somebody please answer the below question?

Answer #2    Answered By: Anthony Rutledge     Answered On: Jan 27

The question is a bit general, so I'm not sure what you are really

To Debug a webpart to remove errors: In the Web.config of the site's web
application locate the following settings and change them as indicated

CallStack should be set equal to "true"

CustomErrors should be set equal to either "Off" or

These settings replace the non-descriptive SharePoint error  message with
a Stack Dump and exception when a web  part errors out. You can use this
info to fix the issue.

Otherwise, you handle errors in a web part just like you do in any other
code. Use Try/Catch blocks to intercept and handle the exceptions.

If the question was about something other than those two please provide
more detail.

Answer #3    Answered By: Heena Nagori     Answered On: Jan 27

Or you can use VSeWSS (Visual Studio Extension for WSS). Setup break
points in your code and you can press F5 to debug. Google VSeWSS to
download the latest version.

Answer #4    Answered By: Aishwarya Karmarkar     Answered On: Jan 27

VSeWSS only works for debugging if your destination site is in the Root
of the webapplicaiton that has the same name as the server. It also
only works if you are running Visual Studio on the server itself. You
can debug any web  part project by setting breakpoints and then attaching
to the W3WP.exe process on the server using the debug menu. It's not as
easy as pressing F5, but it works in a lot more situations.

Didn't find what you were looking for? Find more on Error Handling in custom web parts Or get search suggestion and latest updates.