Checking validity of query string before performing SQL filtering of detailsview

101 views Asked by At

Is there anyway to check the validity of a query string before performing SQL data filtering. I mean my detailsview page is expecting a querystring with numeric values, however, if someone tries to send string or huge number or any invalid data the page will crush!! Even if you send a valid data of a record that doesn't exist anymore the page will still be accessible. I need to enable users to access that page only if there is data display, thanks in advance.

1

There are 1 answers

0
OneFineDay On

In the Page_Load event you check the query string with the IsNumeric() function or any other pattern matching methods(Regex, etc...) and if it does not pass then Redirect to a diff page.