I frequently make use of Request.QueryString[] variables.
In my Page_load I often do things like:
int id = -1;
You can use the extension methods below as well and do like this
int? id = Request["id"].ToInt();
if(id.HasValue)
{
}
// Extension methods
public static int? ToInt(this string input)
{
int val;
if (int.TryParse(input, out val))
return val;
return null;
}
public static DateTime? ToDate(this string input)
{
DateTime val;
if (DateTime.TryParse(input, out val))
return val;
return null;
}
public static decimal? ToDecimal(this string input)
{
decimal val;
if (decimal.TryParse(input, out val))
return val;
return null;
}