c# helper class file stays on shared server even after I delete it, how do I refresh?
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 refres开发者_StackOverflow社区h this helper file?
In contrast to a web site project, ASP.NET MVC uses a web application project meaning that it needs to be compiled for your changes to take effect. When you are working on the local machine and you are running the site inside Visual Studio source code is automatically compiled and changes take effect. For your changes to take effect you need to deploy all the assemblies that are generated in the bin
folder. No need to copy any source files to the server (except of course aspx
and ascx
pages).
精彩评论