Reputation: 15138
I build a website, that:
On local server it works perfect, but when I push it to my live server, the double.Parse fails with an error.
So: - how to track what the double.parse is trying to parse? - how to debug live server?
Lang is ASP.Net / C#.net 2.0
Upvotes: 0
Views: 295
Reputation: 181280
I would use TryParse instead of just plain Parse. That way, you would control what is being intended to parse.
Like this.
double outval;
if (!double.TryParse(yourvar, out outval)) {
// throw and manage error on your website
}
// life goes on.
Upvotes: 2
Reputation: 33511
Sounds like a problem with regional settings and the decimal separator. Might be different in your development/live servers.
Upvotes: 2
Reputation: 887413
You probably have culture issues.
Pass CultureInfo.InvariantCulture
to double.Parse
and see if it helps.
To see the exception on the server, add <customErrors mode="Off" />
to the <system.web>
element in web.config. (And make sure to remove it afterwords)
Alternatively, you can setup a real error logging system, such as ELMAH, or check the server's event log.
Upvotes: 4