Re: What if the Query String is empty?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"exceptions are handled" and "exceptions are not happening" 2 different things...

I did not say that user needs to get ASP.NET error screen with bunch of information if something is not integer.
But if user decided to play with QueryString by hand and put into ProductId his name instead of number he deserves to be redirected to the default.aspx how I do it in case of exception that is caught in Application_OnError

So it's perfectly OK to assume that ProductId is a number (if it's in database) and do a conversion without tipping-toeing around.


George.





"Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx> wrote in message news:ewxfiohPJHA.4372@xxxxxxxxxxxxxxxxxxxxxxx
"George" <noemail@xxxxxxxxxxx> wrote in message news:eCm0dihPJHA.3560@xxxxxxxxxxxxxxxxxxxxxxx

Are we back to this????

What if the sun will not come up tomorrow.....
Any programming is based on assumptions.... And it's good to have those assumptions.

Utter rubbish! Utter, utter garbage!

Robust programming (look it up on Google) is based on doing whatever you can to make sure that exceptions are handled.

Trying to instantiate an integer from something which cannot be converted into an integer will cause an exception.

Trapping for that eventualilty will not...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

.



Relevant Pages

  • Re: Is this the Right way TO release COM interface ?
    ... COM compiler support wrappers actually preserve ... It's not so clean to undo the conversion. ... changing the retval parameter to the return type and adding exceptions, then absolutely use the wrapper classes. ... Are you saying that there's an option to request #import to generate code that doesn't translate HRESULTs into exceptions? ...
    (microsoft.public.vc.language)
  • Re: Contracted exceptions for Ada
    ... the conversion to the fixed-point type _Whatever_ cannot ... Therefore we do not need to handle exceptions for this ... conversion, so we will not do any ... would not make the same mistake while porting the compiler... ...
    (comp.lang.ada)
  • Re: Contracted exceptions for Ada
    ... "The maximum horizontal velocity is ... Therefore the conversion to the fixed-point type _Whatever_ ... do any extra processing to avoid exceptions." ...
    (comp.lang.ada)
  • Re: Contracted exceptions for Ada
    ... "The maximum horizontal velocity is ... Therefore the conversion to the fixed-point type _Whatever_ ... do any extra processing to avoid exceptions." ...
    (comp.lang.ada)
  • Re: pre-check for string-to-number conversion
    ... > I am reading an ASCII data file and converting some of the strings to ... I know that I can us exceptions, ... > conversion, but I can't figure out how to do it. ... but note that this won't except valid floats like '1e10'. ...
    (comp.lang.python)