Wednesday, 15 January 2014

asp.net mvc 3 - remove response parameter in url -



asp.net mvc 3 - remove response parameter in url -

my site on mvc3 razor , on .net 4 framework.

i have href link in view

<a href="http://localhost:17238/news?newsid=20&newsurl=xxx">mylink</a>

this links go news action , news action :

[validateinput(false)] public actionresult index(int newsid, string newsurl) { //do process on newsid , newsurl mymodel mm=new mymodel(); homecoming view(mm); }

it works fine homecoming url include newsid , newsurl parameter ,i know normal how can remove parameter when response returned action?

the way perform http 302 or 301 redirect.

return redirect(); //302 homecoming redirectpermanent(); //301 homecoming redirecttoaction(); //302 homecoming redirecttoactionpermanent(); //301 homecoming redirecttoroute(); //302 homecoming redirecttoroutepermanent(); //301

by performing http 301 redirect telling client permanent redirection (i.e. resource has officially been relocated). browser may cache redirect.

you don't want 301 redirect; mention give finish answer.

asp.net-mvc-3 anchor

No comments:

Post a Comment