Note that there are some explanatory texts on larger screens.

plurals
  1. PODateTime Error in URL
    text
    copied!<p>I'm developing an application in which I pass one URL on <code>inquiry.aspx</code> page and that URL will send a message to the user's email address.</p> <p>That URL looks like:</p> <pre><code>mail.Body += string.Format("&lt;a href=\"http://www.abc.co.in/Download.aspx?period=" + DateTime.Now.ToString("dd-MM-yyyy hh mm") + "&amp;ProductName=" + productName + "\"&gt;Demo Download&lt;/a&gt;"); </code></pre> <p>Now I'm retrieving this to the pageload event of <code>download.aspx</code> page. My code is:</p> <pre><code>string PName = Request.QueryString["ProductName"] as string; string myDate = Request.QueryString["period"] as string; DateTime dt1 = Convert.ToDateTime(myDate); DateTime dt2 = DateTime.Now; int day1, day2; day1 = dt1.Day; day2 = dt2.Day; TimeSpan variable = dt2 - dt1; if (day1!=day2) { //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"; } </code></pre> <p>I'm getting the error:</p> <blockquote> <p>String was not recognized as a valid DateTime</p> </blockquote> <p>My output URL after user clicking on that link from his email id looks like:</p> <pre><code>http://www.abc.co.in/Download.aspx?period=11-04-2013%2006%2036&amp;ProductName=Otja </code></pre> <p>Here datetime is used for condition that after same day means mail is send to user today and today only he can download. Tommorrow onward it will show message that you are not able to download software now. So that is the reason to pass datetime on URL, but I'm getting error. Please someone help me it's required badly. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload