i have problem due to iis turning off + spaces in querystrings.
we have clients posting data hidden page querystring (jobs) , post jobs things c++ in them etc - passing data cannot expect them encode %2b non techie , mix n match fun.
we have places have querystrings within querystrings (sometimes 4 when passing filenames flash file click link, redirect url onclick goes page logs click final url go show customer!).
there other places have urls in urls such redirect on login , on.
plus signs shouldn't problem have found few issues want 1 function can sort out.
for times when have needed encode asp urls (due being no server.urldecode function) though don't need page un-encodes them, use server side javascript asp classic (i know!) function e.g
<script language="javascript" runat="server"> function urldecode(strin) { // js return undefined vars have not been set yet whereas vb doesn't handle if(strin){ var strout = decodeuricomponent(strin); return strout; }else{ //for undefined or nulls or empty strings return empty string return ""; } } </script> however trying round possible problems + signs simple hack replace first placeholder replace after decoding e.g
<script language="javascript" runat="server"> function urldecode(strin) { // js return undefined vars have not been set yet whereas vb doesn't handle if(strin){ strin = strin.replace("+","##plus##"); var strout = decodeuricomponent(strin); strout = strout.replace("##plus##","+") return strout; }else{ //for undefined or nulls or empty strings return empty string return ""; } } </script> however on running getting following error
microsoft jscript runtime error '800a01b6' object doesn't support property or method /jobboard/scripts/vbs/encodefunclib.asp, line 781 this line is
strin = strin.replace("+","##plus##"); i've tried
strin = strin.replace(/\+/g,"##plus##"); strin = strin.replace('/\+/','##plus##'); but nothing seems work.
running code client side javascript works fine don't know why it's not running server side.
i don't want have search 300+ files places function called server side , placeholder/replace around urldecode function know problems , how solve it.is.
at first thought because had moved windows 2012 , iis 8 , had new js.dll needed install (from reading on it) - still have 2003 servers on iis 7 , getting same problem there well.
unless server guy isn't telling me version of iis using on 2003 don't know going on.
can shed light on this.
am being numpty?
what issue?
thanks in advance help.
the regex replace plus signs strin = strin.replace(/\+/g,"##plus##"); because + has meaning in regex, needs escaped backslash.
Comments
Post a Comment