my site is on MVC3 razor and on .Net 4 framework.
I have a href link in my view
<a href="http://localhost:17238/News?NewsID=20&NewsUrl=xxx">mylink</a>
this links go to News action and news action is :
[ValidateInput(false)]
public ActionResult Index(int NewsID, string NewsUrl)
{
//do some process on NewsID and NewsUrl
mymodel mm=new mymodel();
return View(mm);
}
it works fine but return url include NewsId and NewsUrl as parameter ,i know
it is normal but how can i remove all parameter when response returned from my action?
The only way to do this would be to perform an HTTP 302 or 301 redirect.
By performing an HTTP 301 redirect you are telling the client that this is a permanent redirection (i.e. that the resource has officially been relocated). The browser may cache this redirect.
You probably don’t want to do a 301 redirect; I only mention it to give a complete answer.