Issue while Retrieving DateTime from session and calculating TimeSpan in ASP.Net using c#.
<p>I am storing Datetime in a session as mentioned below:-</p>

<pre><code>Session["LoggedInTime"] = System.DateTime.Now;
</code></pre>

<p>Then i m retrieving this value on a page load like this:-</p>

<pre><code>DateTime _loggedInTime = Convert.ToDateTime(Session["LoggedInTime"]);
</code></pre>

<p>I debug the above code code and find that up to here the _loggedInTIme is showing the correct date which i m storing in it. After that i m calculating the time span like this:-</p>

<pre><code>TimeSpan elapsedtimespan = System.DateTime.Now.Subtract(_loggedInTime);
int elapsedtime = Convert.ToInt32(elapsedtimespan.TotalSeconds);
</code></pre>

<p>I found while debugging the code that ,while subtraction the    _loggedInTime = {1/1/0001 12:00:00 AM} and due to which i m not able to get exact elapsedtime .</p>

<p>Please help me to solve this issue as i m not getting why the  _loggedInTime become {1/1/0001 12:00:00 AM} at calculating TimeSpan.</p>
