Having an ampersand in a querystring parameter
javascript, redirect
Solution
You want to URL encode the ReturnUrl querystring.
window.location = "./RedirectPage.aspx?ReturnUrl="+encodeURIComponent("page.aspx?key=val&key2=val2");
Problem
I'm a bit new to javascript and I'm having a minor problem: I'm trying to redirect to a page (which then performs a redirect) in javascript. I'm setting the `window.location` like so: ``` window.location = "./RedirectPage.aspx?ReturnUrl=page.aspx?key=val&key2=val2"; ``` Now, on RedirectPage.aspx when it's trying to redirect to the page that I passed in as the ReturnUrl, it is parsing key2=val2 as being another querystring parameter for RedirectPage instead of the ReturnUrl. It makes sense that it does that, but that's not what I am trying to do... any idea how I might solve this?