C# code behaves differently in localhost vs live server

I have the following C# code in my code behind for a regular Web Application:

protected void Page_Load(object sender, EventArgs e)
{
    if (!validTime())
    {
        btnEdit.Enabled = false;
        btnSubmit.Enabled = false; btnSubmit2.Enabled = false;
        lblSuccess.Text = "It is not currently the time to edit picks for this week.";
        lblSuccess.ForeColor = System.Drawing.Color.Red;
        if (picksMade())
        {
            displayCurrentPicks();
        }
    }
    else
    {
        if (picksMade())
        {
            btnEdit.Enabled = true;
            btnSubmit.Enabled = false; 
            btnSubmit2.Enabled = false;
            displayCurrentPicks();
            lblSuccess.Text = "Viewing your current picks";
            lblSuccess.ForeColor = System.Drawing.Color.Green;
            if (Session["Success"] != null && Session["Success"].ToString() != String.Empty)
            {
                lblSuccess.Text = Session["Success"].ToString();
                lblSuccess.ForeColor = System.Drawing.Color.Green;
                Session.Remove("Success");
            }
        }
        else
        {
            btnEdit.Enabled = false;
            btnSubmit.Enabled = true; btnSubmit2.Enabled = true;
            displayCreatePicks();
            lblSuccess.Text = "Create your picks for this week";
            lblSuccess.ForeColor = System.Drawing.Color.Green;
        }
    }
}

The problem is, this code works great when I test it using ASP.NET Development Server. When I publish it to my live server it has some different behavior.

I have a web method that inserts data into my database with this signature:

[WebMethod]
public static void savePicks(List<string> Points, List<string> Teams, List<string> TieBreaker)

Again, on the test server it runs and works great. The problem is, when the method returns it should refresh the page, and it does, but on the live server my code in the page_load event is not run? or is run differently? It never calls the displayCurrentPicks() method? Or if it does, it does not run correctly? except it runs perfectly on the test server.

I have no way to check this stepping through the code because when I do it works great, on the test server. The live server is hosted on Godaddy.

And I have tried everything. I have tried doing page refreshes after the correct methods and in my javascript to force the page_load event to be run again. Nothing works. I have been at this for a few days now. And I am sure all my code is publishing. I have done all the usual 'stupid checks'. The data is making it to the database, the picksMade() function returns true when there is data there. The data is there by the time the page refreshes.

Why does the live server not run the code I publish to it? Why does it run something different? Or Behave differently? I understand it is a different server, but shouldn't it run the code the same?

Answers


What exactly does the function validTime() do? If you are checking for specific time constraints it may be that your development server is set to your local time zone and that is why it is working but on your live server the timezone may be different. Just a guess though.


Need Your Help

Issue with PUT request in ColdFusion 10

coldfusion coldfusion-10 cfhttp

While working with a API , I need to make a PUT request to a URL along with some parameters needs to be passed as POST parameter.

How to make invisible buttons in Xcode 5?

ios uiimageview xcode5

I'm trying to make a quiz game. I turn the xib view into Image View to place one of my pre-made question images. After I placed the image I choose a button and place it on the image. However, the b...