Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping user.config errors

Status
Not open for further replies.

Skie

Programmer
Jun 21, 2004
475
US
Say this file gets cleared or someone manually edits it and breaks it. Is there a way to trap the error? I've tried try-catch blocks on the properties, but it throws the error within the try-catch block.

I figure I could try to read the file as XML first. If it fails, simply remove it. But, the folder name where it's stored doesn't make that easy (unless someone knows where I can pull that info).

I realize this isn't a very common issue, but it'd be nice to be able to resolve it within the code. That way I don't have to tell the user to delete the file.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top