Exception parsing querystring

D

duncan.welch

Hi,

I've got a website that uses links for page positioning which works
great about 99% of the time. For some reason, 1% of the time I'll get
an error when parsing the querystring, as it's reading the anchor name
as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review

occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage to
solve it?

Thanks in advance,

Duncan
 
G

Guest

Your "?venueID=" may contain strings symbols thus during converting got
excetion.
Try to use either Int32.TryParse or use regext before type casting to be
sure that you venueID contains number symbols.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
D

duncan.welch

Thanks for the feedback; the venue ID definately is numeric, as I'm
logging the errors. I can even cut and paste the querystring from the
error message in, and it *normally* works.

It just seems to be reading the # as part of the querystring.

Any other ideas?

Duncan

Michael said:
Your "?venueID=" may contain strings symbols thus during converting got
excetion.
Try to use either Int32.TryParse or use regext before type casting to be
sure that you venueID contains number symbols.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Hi,

I've got a website that uses links for page positioning which works
great about 99% of the time. For some reason, 1% of the time I'll get
an error when parsing the querystring, as it's reading the anchor name
as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review

occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage to
solve it?

Thanks in advance,

Duncan
 
M

Michael Nemtsev

Hello Dunc,

"reading the # as part of the querystring"?
What does it mean?

D> Thanks for the feedback; the venue ID definately is numeric, as I'm
D> logging the errors. I can even cut and paste the querystring from
D> the error message in, and it *normally* works.
D>
D> It just seems to be reading the # as part of the querystring.
D>
D> Any other ideas?
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Your "?venueID=" may contain strings symbols thus during converting
got
excetion.
Try to use either Int32.TryParse or use regext before type casting to
be
sure that you venueID contains number symbols.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

Hi,

I've got a website that uses links for page positioning which works
great about 99% of the time. For some reason, 1% of the time I'll
get an error when parsing the querystring, as it's reading the
anchor name as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review
occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage to
solve it?

Thanks in advance,

Duncan
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
D

duncan.welch

Hi Michael,

The # should terminate the querystring, and be read by the browser as a
position on the page to jump do, defined with an anchor (e.g. <a
name="reviews"></a>).

What appears to be happening occasionally is .NET is reading the
#review as part of the venueID=1964 Querystring key/pair, and throwing
a number format exception.

I'm completely at a loss to why this is happening, and I'm really
surprised other people haven't come across this!

Duncan

Michael said:
Hello Dunc,

"reading the # as part of the querystring"?
What does it mean?

D> Thanks for the feedback; the venue ID definately is numeric, as I'm
D> logging the errors. I can even cut and paste the querystring from
D> the error message in, and it *normally* works.
D>
D> It just seems to be reading the # as part of the querystring.
D>
D> Any other ideas?
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Your "?venueID=" may contain strings symbols thus during converting
got
excetion.
Try to use either Int32.TryParse or use regext before type casting to
be
sure that you venueID contains number symbols.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

:

Hi,

I've got a website that uses links for page positioning which works
great about 99% of the time. For some reason, 1% of the time I'll
get an error when parsing the querystring, as it's reading the
anchor name as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review
occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage to
solve it?

Thanks in advance,

Duncan
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
M

Michael Nemtsev

Hello Dunc,

Could u demonstrate the url that breaks it?

D> Hi Michael,
D>
D> The # should terminate the querystring, and be read by the browser as
D> a position on the page to jump do, defined with an anchor (e.g. <a
D> name="reviews"></a>).
D>
D> What appears to be happening occasionally is .NET is reading the
D> #review as part of the venueID=1964 Querystring key/pair, and
D> throwing a number format exception.
D>
D> I'm completely at a loss to why this is happening, and I'm really
D> surprised other people haven't come across this!
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Hello Dunc,

"reading the # as part of the querystring"?
What does it mean?
D> Thanks for the feedback; the venue ID definately is numeric, as
I'm
D> logging the errors. I can even cut and paste the querystring from
D> the error message in, and it *normally* works.
D>
D> It just seems to be reading the # as part of the querystring.
D>
D> Any other ideas?
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Your "?venueID=" may contain strings symbols thus during converting
got
excetion.
Try to use either Int32.TryParse or use regext before type casting
to
be
sure that you venueID contains number symbols.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its
opponents
do not cease to be insipid." (c) Friedrich Nietzsche
:

Hi,

I've got a website that uses links for page positioning which
works great about 99% of the time. For some reason, 1% of the
time I'll get an error when parsing the querystring, as it's
reading the anchor name as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review
occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage
to solve it?

Thanks in advance,

Duncan
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
D

duncan.welch

Michael,

Here's a URL that has previously broken it. Please note the caveat -
it works 99 out of 100 times!

http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review

Dunc

Michael said:
Hello Dunc,

Could u demonstrate the url that breaks it?

D> Hi Michael,
D>
D> The # should terminate the querystring, and be read by the browser as
D> a position on the page to jump do, defined with an anchor (e.g. <a
D> name="reviews"></a>).
D>
D> What appears to be happening occasionally is .NET is reading the
D> #review as part of the venueID=1964 Querystring key/pair, and
D> throwing a number format exception.
D>
D> I'm completely at a loss to why this is happening, and I'm really
D> surprised other people haven't come across this!
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Hello Dunc,

"reading the # as part of the querystring"?
What does it mean?
D> Thanks for the feedback; the venue ID definately is numeric, as
I'm
D> logging the errors. I can even cut and paste the querystring from
D> the error message in, and it *normally* works.
D>
D> It just seems to be reading the # as part of the querystring.
D>
D> Any other ideas?
D>
D> Duncan
D>
D> Michael Nemtsev wrote:
D>
Your "?venueID=" may contain strings symbols thus during converting
got
excetion.
Try to use either Int32.TryParse or use regext before type casting
to
be
sure that you venueID contains number symbols.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its
opponents
do not cease to be insipid." (c) Friedrich Nietzsche
:

Hi,

I've got a website that uses links for page positioning which
works great about 99% of the time. For some reason, 1% of the
time I'll get an error when parsing the querystring, as it's
reading the anchor name as part of the number.

e.g.
http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review
occasionally gives an error on the line:

int venueID = Convert.ToInt32(Request.QueryString["venueID"]);

Has anyone come across this before, and if so how did they manage
to solve it?

Thanks in advance,

Duncan

---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top