Please see my comment to the question: you really need to learn how exception work. They have nothing to do with your understanding of "errors". Please don't consider my answer as an attempt to resolve your problem: it is not possible before you learn things properly.
But, to start with: this
try {
img = b.Encode(encodingType, Request.QueryString.Get("c"));
} catch (Exception ee) {
throw;
}
is strictly equivalent to
img = b.Encode(encodingType, Request.QueryString.Get("c"));
It's totally pointless to catch exception and throw it again. Besides, this code gives you a compiler warning, because
ee
is not used. You should not do this, ever, but you should not also block propagation of exception by not re-throwing it or throwing another exception. As a rule of thumb, the best way is not to catch exceptions at all, except the very top of stack of each thread. When exception is thrown, let it go until it jumps up the stack to the place where you know how to handle it specifically.
Exceptions is a time machine: you mark a place on a stack, and let exceptions go. If an exception is thrown, the execution will ignore the piece of stack between "try" (not by code structure but by time) and will jump back to the try-catch content, as if nothing happened. If you still did not get the idea (most likely you did not, but it would be OK), you need to start from the very basics. You will never sorry about the time spent, trust me.
—SA