wikinevis
wikinevis

Reputation: 189

xml reader in asp mvc

I have read rss feed by below function

  using (XmlReader reader = XmlReader.Create(feedUri.AbsoluteUri))

but sometimes, when the URL is not valid (404) it shows error. how can I validate the URL before read it with this function?

Upvotes: 1

Views: 417

Answers (1)

SLaks
SLaks

Reputation: 887453

Add a catch block and handle the WebException as desired.

Upvotes: 1

Related Questions