December 30th, 2013, 04:14 AM
Wrong data displayed after uploading to host
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 ?
December 30th, 2013, 02:27 PM
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.
December 31st, 2013, 03:21 AM
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 :
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.
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;
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...
January 2nd, 2014, 02:19 AM
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).