[英]String was not recognized as a valid DateTime
我的代码是.......
string PName = Request.QueryString["ProductName"] as string;
string myDate = Request.QueryString["period"];
string sql = "select FileName from tblProduct Where ProductName=" + PName;
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
{
//string url1 = " http://www.shreehans.co.in/files/" + PName +"";
//Response .Redirect ()
lblmsg.Visible = true;
lblmsg.Text = "U can Still Download";
}
而且我的URl带有querystring参数...
mail.Body + = string.Format(“ http://www.abc.co.in/Download.aspx?period=” + DateTime.Now +“&ProductName =” + productName +“ \\”>演示下载“);
如果在url(查询字符串)中包含日期,则应将其编码为Server.UrlEncode(DateTime.Now)
。
此外:
\\"
。 这样可以解决您的问题
mail.Body +=
string.Format("http://www.abc.co.in/Download.aspx?period=" +
DateTime.Now.ToString("dd-MMM-yyyy") +
"&ProductName=" + productName + "\">Demo Download");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.