#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    17
    Rep Power
    0

    Wrong data displayed after uploading to host


    Hi guys,
    So I have this weird problem and I have no idea what could cause it...

    First of all I am fairly new to programming in general and .net in particular.

    My issue is that the data displayed in a table is right when I run the website locally but when I upload it to the web hosting (godaddy) it suddenly show numbers that are not even in the database!

    I do not use a gridview. When the page loads I create a table with every 2 rows another table inside it. The wrong data is displayed in the "inside table" but not in every rows...

    Any ideas what could cause the issue ?

    Thanks !
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,294
    Rep Power
    9400
    How about posting some code? Specifically the part where you get the data to be displayed as well as, naturally, the part where you output it.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    17
    Rep Power
    0
    Looking back at my code, I saw this has nothing to do with the database but with one function that somewhat, when uploaded to the webhosting, returns the wrong value (locally it works fine).
    To check that the issue was indeed from this function, I output the result on a simple label.
    Here is the function :


    Code:
     
     public static int getRank(string text)
        {
          HtmlDocument page = new HtmlWeb().Load("http:// Website Address");
    
          HtmlNodeCollection nodes = page.DocumentNode.SelectNodes("//div[@class='details']");
          int rank = 0;
          if (nodes != null)
          {
            for (int i = 0; i < nodes.Count; i++)
            {
              if (nodes[i].InnerHtml.Contains(text)) //The text I'm looking for
              {
                rank = i + 1;
                break;
              }
    
            }
          }
          return rank;
        }
    I tried with another node that gives the same results and again locally it works but when uploaded it gives me what seems to be a random number.

    EDIT: I tried a lot of things, like looking for other nodes and printing out their inner html and always get a result that's not relevant... Don't know what to do because it always work locally...
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    17
    Rep Power
    0
    Found the problem.... I use the Html agility Pack to retrieve the html of an external url. The html retrieved isn't the same locally and the web hosting server (thus the values calculated from it weren't the same), I think because of the IP isn't the same...

    Anyway it's fixed (I just had to add a parameter to the url).

IMN logo majestic logo threadwatch logo seochat tools logo