in my application i have send one link to User's email id he can download software on clicking this link....now my url is look like.... http://www.abc.co.in/Download.aspx?period=11/04/2013%2012:29:20%20PM&ProductName=Otja and my code for retriving this value on pageload download.aspx page is
string PName = Request.QueryString["ProductName"] as string;
string myDate = Request.QueryString["period"];
if (!String.IsNullOrEmpty(myDate))
{
myDate = myDate.Replace("!", ":");
}
DateTime dt1 = Convert.ToDateTime(myDate);
DateTime dt2 = DateTime.Now;
TimeSpan variable = dt2 - dt1;
if (variable.TotalMinutes > 5)
{
//Response.Write("Download time is expired now");
lblmsg.Visible = true;
lblmsg.Text = "Download time is expired now";
}
else
{
lblmsg.Visible = true;
lblmsg.Text = "U can Still Download";
}
but this is not working i tested and before 5 Minute and after minutes it is only shows "You can still download" so i think my error is that i can not retrive that productname and period value on querystring on this download.aspx page..please help me.. thanks i think there should be error..... String was not recognized as a valid DateTime. thats why it is pass null value so any solution ???