Developer forum

Forum » Development » Url rewriting passing spaces in the querystring value in a custom module.

Url rewriting passing spaces in the querystring value in a custom module.


Reply

Hi there,

I'm making a hypothetical drinks and beverages module where it's possible to mix drinks by selecting ingredients. I've created a page mixdrinks.

Say as a user I want to make a drink called Screwdriver, which basically is a mix of vodka and orange juice. Therefore i have select the ingredients and submit the form and my module will providing me with the right drink, as long as I pass it the right ingredients in the querystring.
Therfore in my request I get a querystring variable called "mix" and which my user has given the the value "vodka and orangejuice" for the ingredients.

With url rewriting I expect Dynamicweb to create a querystring like this when using SearchEngineFriendlyURLs.getSearchFriendlyUrl("/Default.aspx?ID=1&mix=vodka and orangejuice","");

http://mydrinksandbeveragesmodule.nl/mixdrinks/[mix/vodka%20and%20orangejuice]/Default.aspx

Unfortunatelly I'm getting a querystring like this:

http://mydrinksandbeveragesmodule.nl/mixdrinks/[mix/vodka]/Default.aspx

As you understand I'm not getting very happy customers with this drinks and beverages module because Dynamicweb only seems to give "vodka" to my mix variable. The other ingredients are lost because the method doesn't seem to handle
the spaces in the value of the querystring.

Some environmental information:
I've selected the right iis 404 handler ("/Admin/public etc etc").
I've tried various url rewriting settings in the management center for one being replacing spaces with _ or - options don't seem to have an effect on the result.

Am I using the right method?

Is there a way to get around this problem?

Is this behaviour by design?

Lucas


 


Replies

 
Nicolai Høeg Pedersen
Reply
Not exactly by design, but consider that a [space] is not a valid querystring parameter value... You should URI encode all values sent to the querystring - that would ultimately solve the problem.
 
Reply

Hi there

I've tried encoding.
 

Before rewriting encoding space with %20 becomes a 20 after rewriting
Before rewriting encoding space with + are stripped after rewriting

This behaviour is not according to w3cschool standards

http://www.w3schools.com/TAGS/ref_urlencode.asp

I would suggest this being a bug?

 
Nicolai Høeg Pedersen
Reply
Just ran some tests - and yes this is a bug.

If you change the method from "Foldered query string" to "Encryption" in management center it seems to work.

 

You must be logged in to post in the forum