OK to throw an error for a missing required querystring parameter?

Posted by Balazs on Stack Overflow See other posts from Stack Overflow or by Balazs
Published on 2010-05-19T12:07:27Z Indexed on 2010/05/19 12:10 UTC
Read the original article Hit count: 296

Filed under:
|

Is there anything wrong with having an asp.net page throw a (custom error) if a a required querystring parameter is missing and having global.asax catch it with Application_Error, then transfer the user to an error page? I have several base classes that perform these checks and I am not sure of the best way to communicate the error to a user.

So, something like this:

int reqParam;
if(!isParamSet("myReqParam", out reqParam))
{
   throw new QuerystringParamMissingException();
}

which is then caught by Application_Error in global.asax.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#