c# - ASP.net not catching QueryString -
i have created asp.net application,where change language base on query string. have 2 servers both https ,but 1 redirected netscaler
https://testmylivecode.com https://mynetscalerserver.com/testapply-au4uc6q9du94nhzvza6zdtaqe433xa2a/?
for eg
https://testmylivecode.com/?ln=en
this asp.net code
string strnewlanguage = request.querystring["ln"].tolower(); sessionhelper.language = strnewlanguage ; string strnewurl = request.rawurl.tolower().replace("ln=" + request.querystring["ln"], ""); response.redirect(strnewurl);
what change language depending on querystring , change querystring , redirects
this works https server
https://testmylivecode.com/?ln=en
but doesnt work netscaler url
https://mynetscalerserver.com/testapply-au4uc6q9du94nhzvza6zdtaqe433xa2a/?
this url
and after added querystring it,it not work https://mynetscalerserver.com/testapply-au4uc6q9du94nhzvza6zdtaqe433xa2a/??ln=en
can why not working url has ? in it??? help
my suggestion change string contains '?', can't below instruction , code might writing below code based on language array, need modify based on requirement, help.it's bad code have modify make good
string[] obj = new string[5] {"hi","en","ar","or","xy" }; string urlstring = request.rawurl.tolower(); int location = 0; (int = 0; < obj.length; i++) { if (urlstring.contains("=" + obj[i])) { location = i; break; } } string strnewurl = request.rawurl.tolower().replace("ln=" + obj[location], ""); response.redirect(strnewurl);
Comments
Post a Comment