Saturday, March 31, 2012

System.InvalidCastException:

I have a page that gets a value from the querystring. I believe people click certain javascript functions on the page that sometimes appends a "#". I have never seen a page error out to this, but I am getting my logfile full of errors like the one below?

System.InvalidCastException: Cast from string "146586#" to type 'Integer' is not valid.

What would be a good way to stop this? Should I somehow trim the very last character if its equal to a "#" .

If so, how can I achieve this?

Thanks
mike123That is weird. The only time I have seen a # appended is when somebody uses the onclick in a A tag

for instance:Click me

In my opinion and to avoid these @.$R # signs is to use this:

Click Me

0 comments:

Post a Comment