Using asp.net mvc2 on vs2008 on local machine and hosting on a shared server at discountasp.net
Problem started when I could not make the .UTCNow deliver the correct "Office is open/closed" string as follows:
In the view user control:
<div><%=OfficeTimes.LondonOpenOfficeMessage() %></div>
And in the helper file:
public static class OfficeTimes
{
public string LondonOpenOfficeMessage()
{
if (DateTime.UtcNow.Hour < 17 && DateTime.UtcNow.Hour > 7)
{
return "Office is currently closed";
}
else
{
return "Office is currently open";
}
}
}
so I changed the return string to the UTC (as below) to see if it was returning the correct time and still compiled as if it was the original.
public static class OfficeTimes
{
public string LondonOpenOfficeMessage()
{
if (DateTime.UtcNow.Hour < 17 && DateTime.UtcNow.Hour > 7)
{
return DateTime.UtcNow.Hour.ToString(); //"Office is currently closed";
}
else
{
return DateTime.UtcNow.Hour.ToString(); //"Office is currently open";
}
}
}
I tried deleting the file...it still compiled.
All worked fine on the local machine.
Does anyone know the server does not refresh this helper file?