# character in querystring

G

Guadala Harry

When passing the '#' character as part of a querstring value, the received
Querystring value gets truncated just prior to the '#' character.

Exmple:

string s = "someColor=#0000FF";
On the receiving side, a zero-length string is received.

string s = "someColor=TestThis#0000FF";
On the receiving side, only "TestThis" is received (the #0000FF has been
lost).

Just for fun, I used HTMLEncode() on this and it has no effect on the #
character (still drops it and everything that follows).

What can I do about this? I need to receive the # character and everything
that follows - via Querystring.

Thanks.
 
A

ashelley

When passing the '#' character as part of a querstring value, the received
Querystring value gets truncated just prior to the '#' character.

Exmple:

string s = "someColor=#0000FF";
On the receiving side, a zero-length string is received.

string s = "someColor=TestThis#0000FF";
On the receiving side, only "TestThis" is received (the #0000FF has been
lost).

Just for fun, I used HTMLEncode() on this and it has no effect on the #
character (still drops it and everything that follows).

What can I do about this? I need to receive the # character and everything
that follows - via Querystring.

Thanks.

# is used in urls for anchors. try another character?

-Adam
 
G

Guadala Harry

# is used in urls for anchors. try another character? <<<


# is also used as part of the hex definition of a color (e.g., #0000FF gives
you blue).

I guess I'll have to substitute something else for # in my case here unless
someone else has any other ideas..

Thanks.
 
D

darrel

# is also used as part of the hex definition of a color (e.g., #0000FF
gives
you blue).

# is reserved in the context of a URI. You're referring to it being reserved
in the context of HTML/CSS.
I guess I'll have to substitute something else for # in my case here unless
someone else has any other ideas..

Well, in a URL, anything after # is considered an anchor name, so, you can't
pass it as part of a string AFAIK.

What are you ultimately trying to do? If you're just passing a hex value,
I'd just pass the numbers:

?hex=999999

then, before you use them just append the # in your asp.net code.

-Darrel
 
G

Guadala Harry

What are you ultimately trying to do?<<<<

Basically this is an academic exercise in which I'm trying to duplicate some
of the functionality commonly found in various online CSS tutorials in which
you can pick a color (or other style property), click a refresh button, and
then see the effect elsewhere in the page.

I'm open to other ideas, but for now I'm doing this with framesets in which
I show a "preview" area in one page/frameset, and accept user css style
preferences in another page/frameset. From settings in one frame I style the
page in another frame. The way I pass the style info between the framesets
is via QueryString (thus the need to pass hex color information via
Querystring).

-G
 
B

bruce barker

use UrlEncode with querystrings, which will translate it to %23

-- bruce (sqlwork.com)
 

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

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top