I am trying to pass a variable in the URL to a popup window. One of the variables in the URL has a value of S&CSB. Whenever I try to get at this variable it returns only "S". I did URL encode the "&" ampersand (%26) and (&and (S%26amp%3B), so I don't get why it's not working. Looks to me like ASP Request.Querystring is parsing from the ampersand on. I put the code below.
Thanks for your thoughts!
Code:<%@ Language=VBScript %> <html> <head> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <script language=javascript> var curPopupWindow = null; function openPopupFocus(url, name, pWidth, pHeight, features, snapToLastMousePosition, closeOnLoseFocus) { alert(url) closePopup(); if (snapToLastMousePosition) { if (lastMouseX - pWidth < 0) { lastMouseX = pWidth; } if (lastMouseY + pHeight > screen.height) { lastMouseY -= (lastMouseY + pHeight + 50) - screen.height; } lastMouseX -= pWidth; lastMouseY += 10; features += ",screenX=" + lastMouseX + ",left=" + lastMouseX + ",screenY=" + lastMouseY + ",top=" + lastMouseY; } if (closeOnLoseFocus) { curPopupWindow = window.open(url, name, features, false); curPopupWindow.focus (); } else { // assign the open window to a dummy var so when closePopup() is called it won't be assigned to curPopupWindow win = window.open(url, name, features, false); win.focus (); } } function closePopup() { if (curPopupWindow != null) { if (!curPopupWindow.closed) { curPopupWindow.close(); } curPopupWindow = null; } } </script> <script language=JavaScript RUNAT=SERVER> // This function decodes the any string // that's been encoded using URL encoding technique function URLDecode(psEncodeString) { return unescape(psEncodeString); } </script> </head> <body> <br><br> This page CLEAN popup... <br> <%Response.Write("subgroup= " & URLDecode(Request.Querystring("subgroup")))%> <br> <a href="javascript:openPopupFocus('SalesTest.asp?countrycode=01&subgroup=S%26CSB¤cycode=01');">Test %26</a><br><br> <a href="javascript:openPopupFocus('SalesTest.asp?countrycode=01&subgroup=S%26amp%3BCSB¤cycode=01')">Test %26amp%3B</a><br><br> <a href="javascript:openPopupFocus('SalesTest.asp?countrycode=01&subgroup=S&CSB¤cycode=01');">Test &</a><br><br> <a href="javascript:openPopupFocus('SalesTest.asp?countrycode=01&subgroup=S%26CSB¤cycode=01');">Test %26</a><br><br> <a href="javascript:openPopupFocus('SalesTest.asp?countrycode=01&subgroup=S&CSB¤cycode=01')">Test amp;</a><br><br> <br><br><br><br>



and (S%26amp%3B), so I don't get why it's not working. Looks to me like ASP Request.Querystring is parsing from the ampersand on. I put the code below.

the first will replace both "||" that is required for the second.
Bookmarks