ASP.NET MVC > Redirect

Redirect user to another page from controller action method in ASP.NET MVC

How to redirect the user to another page from controller action method?


To redirect the user to another page (either external or internal), we can use Redirect method like below.

public ActionResult Index()
        {
            return Redirect("http://www.itfunda.com"); // redirects to external url
         }

public ActionResult Index()
        {
            return Redirect("/FilesModels/Create"); // redirects to internal url
         }

Remember that to redirect to external url, we need to provide complete url starting with http. For internal redirect, url can be provided from root of the application.

 Views: 15987 | Post Order: 55



Write for us