asp.net mvc - ReturnUrl Duplicating Parameters - MVC 4 -
i'm having problem retunurl duplicating querystring parameters.
my url like:
"www.mysite.com/order/?id=1&item=123"
then, redirect me login page , url like:
"www.mysite.com/login/redirecturl=/order?id=1&item=123&id=1&item=123"
after user login, action redirect to:
"www.mysite.com/order/?id=1&item=123&id=1&item=123"
in page when use request.querystring["id"] got error, because querystring "id" duplicated.
my login action code this:
[httppost] [allowanonymous] public actionresult index(loginmodel model, string returnurl) { if(verifylogin(model)) { if(returnurl != null) return redirect(returnurl);//redirect url duplicated parameters else return redirect("/home"); } else { modelstate.addmodelerror("", "invalid username or password"); } return view(); }
how can solve problem?
i think problem in order controller or returnurl assignment logic. might adding url+querystring. if yes can try request.url.getleftpart(uripartial.path) + querystring
Comments
Post a Comment