>From what I understand, this is possible. I also had to test for this
at work too. I would do something like this:
1) I had some code from my manager that only recently made sense to
me. You want to use the following code as its own function on current
page, or put it in a common file (if you're storing common functions):
public static bool isNumeric(object value)
{
try
{
double d = System.Double.Parse(value.ToString(),
System.Globalization.NumberStyles.Any);
return true;
}
catch (FormatException)
{
return false;
}
}
2) Running off Cerebrus' code earlier, I would then on the behind the
code page do the following (rough code here; haven't verified syntax):
string cngID = Request.QueryString["CngId"];
if (!string.IsNullOrEmpty(cngID))
{
if (isnumeric(cngID))
{
int intResult;
int.TryParse(cngID, out intResult);
HYPViewCng.NavigateUrl = "~/Admin/CngSection/ViewCng.aspx?
CngId="
+ intResult;
}
else
{
//Whatever you need to do here, whether redirect or post
message.
//My gut instinct would be to redirect.
}
}
else
{
// Log error or handle appropriately.
}
Not sure if this completely helps, but should be a good start.
On Jan 1, 12:03 pm, "m...@ni" <[email protected]> wrote:
> ok cerebrus and chuck 1 more thing came to my mind regarding checking
> of the querystring,whether it is null or not, the point is that as i
> am taking CngId, which means that its gona take only the
> integers,because on the basis of this cngId, i have to execute another
> functionality,now wat if a user enters 'a' or '#' in the url (as the
> querystring is visible in the url) because watever comes in the
> querystring, i am assigning it to cngId,ok i got tht how to chk
> whehter it is null or not,but how i overcome this problem.
>
> suppose instead of writing this url
> "http://indexCNG.aspx?CngId=1"
>
> a person enters this url,then an error came because of that,what to do
> in this regard
> "http://indexCNG.aspx?CngId=a"