3

How does one go about catching exceptions from using controls in markup?

For example, I have the following code

<asp:XmlDataSource ID="XmlDataSource1" 
                   runat="server" 
                   DataFile="http://feeds.feedburner.com/"
                   XPath="rss/channel/item [position()<=10]"></asp:XmlDataSource>

If feedburner is down for whatever reason, where does the exception get thrown too and how do I catch this?

2 Answers 2

3

I would probably resort to setting the properties in code behind and handling the data binding manually within a try/catch block. This would allow you to eat the exception and put up some sort of error message.

Sign up to request clarification or add additional context in comments.

Comments

1

You could always let it fall through to Application_Error in Global.asax.cs, if you have any kind of global error handling in place.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.