c# - redirection to other page with encoded url -
i using 1 image on html page. adding 1 anchor image give link. anchor contains href ~/lb/lct.aspx?pid=177&cat=happily in love
main thing url coming database. manually not entering it..
so invalid url because of spaces between happily in love
i used httputility.urlencoding , decoding also........but problem facing that..
url endoded while clicking on image not redirecting proper page because encoded url not decoded..
how resolve this...pls me on this....
here code
string url = "~/lb/lct.aspx?pid=177&cat=happily in love"; //your input string[] arr = url.split('?'); var namevalues = httputility.parsequerystring(arr[1]); foreach (var n in namevalues.allkeys) { namevalues.set(n, httputility.urlencode(namevalues[n])); } url = arr[0] + "?" + namevalues.tostring(); //your output
use following code decode querystring values
string cat = httputility.urldecode(request.querystring["cat"].tostring());
Comments
Post a Comment