As part of a registration process a member can either verify their email address or delete the account if they do not wish to continue. This is done via a query string from an email, where I grab the member id on page load. To help with this I'm using
... public bool memberExists(int memId){ Member m = new Member(memId); if (m != null) { return true; } else { return false; } } ...
So far I can verify or delete an account if the member exists. What I want to do is to display a 'the account has already been deleted' message in the usercontrol if the acount does not exist (I.e. already been deleted) when the above returns false. This is message is set up in the control. But if I pass an ID in the query string (say 1702) that does not exist. The server error 'No node exists with '1702' is displayed.
Not sure how to catch the server error and display the the account has already been deleted' message. Would be grateful, if someone could point me in the right direction.
Check if a member exists by id
Hi Guys,
As part of a registration process a member can either verify their email address or delete the account if they do not wish to continue. This is done via a query string from an email, where I grab the member id on page load. To help with this I'm using
So far I can verify or delete an account if the member exists. What I want to do is to display a 'the account has already been deleted' message in the usercontrol if the acount does not exist (I.e. already been deleted) when the above returns false. This is message is set up in the control. But if I pass an ID in the query string (say 1702) that does not exist. The server error 'No node exists with '1702' is displayed.
Not sure how to catch the server error and display the the account has already been deleted' message. Would be grateful, if someone could point me in the right direction.
Thanks,
Eddie
Hi Eddie,
You could wrap the code with a try / catch to supress the exception:
HTH,
Hendy
Hi Hendy,
Of course, thanks worked a treat.
Eddie
is working on a reply...