Friendly Url removing encoded amperstand from query string
Vote:
Hey guys I have a bit of a werid issue which I want to run by you. The basic problem is when I am passing information between pages using a query string to store values any text which contains an ampersand has the ampersand and any following text removed from the finial url. The information is always url encoded. For example the url before I do a response redirect is:
?autonomyName=appearance_measurement_motion_scale_time&conceptName=Motion%2c+Measurement%2c+Scale+%26+Time&searchTerms=made
but on reaching the other page it is changed to:
?autonomyName=appearance_measurement_motion_scale_time&conceptName=Motion%2c%2520Measurement%2c%2520Scale%2520&searchTerms=made
Notice the lack of "+%26+Time" from the url. Is this a known issue with episerver or has anyone got any ideas?
The url if it was not encoded would look something like this. However as I am encoding as the url is built up any information is always encoded before the Response.Redirect method is called.
?autonomyName=appearance_measurement_motion_scale_time&conceptName=Motion, Measurement, Scale & Time&searchTerms=made
What type of encoding are you doing? I can reproduce the problem with Server.HtmlEncode and Server.UrlPathEncode, but it works ok with Server.UrlEncode.
Insert the following somewhere in your default.aspx:
|
|
Server.HtmlEncode |
Server.UrlEncode |
Server.UrlPathEncode
<%= OutputQueryString() %>
and play around with the links. Hopefully you can find the one that works best for you.
/Steve
I am using HttpUtility.UrlEncode to do my encoding which works fine when using a standard asp.net application but seems to fail within the episerver environment.
Hello Michael!
What version are you using? If I don't remember wrong there was a bug with this in 4.60 that was fixed in 4.61. If you are running on 4.60, try if a upgrade may solve your problem.
There is a bug in 4.61 that removes the querystring on postbacks. Hopefully fixed in next hotfix.
With some inheritance and own implementations it can be fixed on current versions.
/HAXEN