While migrating any .Net application from .Net 2003 to .Net 2005 and above we usally get this warning
This warning exists because this method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
Steps to resolve this issue
1. Add a project reference to System.Configuration.dll.
2. Replace all ConfigurationSettings.AppSettings with ConfigurationManager.AppSettings.
Further if u still get Configuration file app.config or web.config cannot be read
Follow this steps
1. Click on App.config
2. Change build action propert to "Embedded Resource" to "None"
Tuesday, September 9, 2008
Tuesday, August 26, 2008
Friday, April 25, 2008
How to convert milliseconds in GMT to datetime to local timezone
public static DateTime CovertToLocalDateTime(long value)
{
DateTime local = new DateTime();
try
{
long ticks = value * TimeSpan.TicksPerMillisecond;
DateTime utc = new DateTime(1970, 1, 1);
DateTime dotnetEquivalent = utc.Add(new TimeSpan(ticks));
local = dotnetEquivalent.ToLocalTime();
}
catch (Exception ex)
{ }
return local;
}
{
DateTime local = new DateTime();
try
{
long ticks = value * TimeSpan.TicksPerMillisecond;
DateTime utc = new DateTime(1970, 1, 1);
DateTime dotnetEquivalent = utc.Add(new TimeSpan(ticks));
local = dotnetEquivalent.ToLocalTime();
}
catch (Exception ex)
{ }
return local;
}
Thursday, March 27, 2008
Get local machine's current time zone
System.TimeZone.CurrentTimeZone gives you the machine's current time zone.
Subscribe to:
Posts (Atom)