Request information about movie from IMDB.
using System;
using System.Text.RegularExpressions;
using System.Web;
namespace MovieNavigator.Web
{
public class Helpers
{
public static int GetUrlVar(string varName)
{
if (HttpContext.Current.Request.QueryString.Get(varName) != null)
{
var isNumber = new Regex(@"^\d+$");
var m = isNumber.Match(HttpContext.Current.Request.QueryString.Get(varName));
return m.Success ? Convert.ToInt32(HttpContext.Current.Request.QueryString.Get(varName)) : 0;
}
return 0;
}
public static string GetUrlVarStr(string varName)
{
if (HttpContext.Current.Request.Params[varName] != null)
return HttpContext.Current.Request.Params[varName];
return string.Empty;
}
}
}