Query String Problem

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/16/2012 12:19:16 PM
Gravatar
Total Posts 148

Query String Problem

I am dynamically rendering a link like this:

<a href=mypage.aspx?item=You%20%26%20I></a>

I want the Request.QueryString["item"];

to read,

You & I

but when I hover over the link, the query string is "You & I" and when I click on the link the page load thinks the "&" is a special character.

When I hover over the link, I want the hint to read mypage.aspx?item=You%20%26%20I

How do I have the link rendered as I set it?

4/16/2012 12:38:38 PM
Gravatar
Total Posts 18439

Re: Query String Problem

Hi,

Technically that looks correct and Request.QueryString should in theory url decode that as You & I

But sometimes there are differences between theory and practice. What I would try is change the way you are rendering the link like this and see if that works

<a href='mypage.aspx?item=You+%26+I'>link text</a>

spaces can be encoded as + instead of %20

also make sure you use quotes around the href.

Hope that helps,

Joe

4/16/2012 1:33:20 PM
Gravatar
Total Posts 148

Re: Query String Problem

My links are rendering correctly but for some reason the Browser is converting my dynamically rendered links and then sending the converted values to the next page.

It's interesting because if I hard code the links, it works fine.

If I create two pages and hard code a link  <a href='page2.aspx?index=You%20%26%20I'></a>

The Request.QueryString on the Page_Load for page 2.aspx is reading index="You & I".

For some reason the Browser is converting my dynamically rendered links.

I will try to create a work around, like using another character to represent the "&" and replacing it back on page load.  I just don't see any other solution.

4/16/2012 9:33:35 PM
Gravatar
Total Posts 148

Re: Query String Problem

 The links appear to be ok in IE and Chrome but FireFox is a problem. 

4/17/2012 9:33:41 AM
Gravatar
Total Posts 148

Re: Query String Problem

It appears to be working in all 3 Browsers now.  

What I needed to do was after using the variable I retrieved from the query string, I had to remember to replace all instances of the "&" with "%26" before I rendered the variable a second time inside an <a> tag.

You must sign in to post in the forums. This thread is closed to new posts.