我的代码是:
protected void Page_Load(object sender, EventArgs e)
{
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");
}
else
{
Response.Redirect("Default.aspx", false);
}
}
我收到如下错误:
字符串未被识别为有效的日期时间。