Thursday, 8 December 2016

ASP.NET MVC C# - Redirect to External Website from Controller Action Method

Refer the below code snippet for redirection from ASP.NET MVC Controller to an external website.
The MVC Controller method "Redirect()", is used for redirection from MVC Controller.

public ActionResult Index()
{
    return Redirect("http://www.google.com");
}

Redirect() method can be used for redirecting to an internal url as well.
Find the sample code below:
public ActionResult Index()
{
    return Redirect("/Customer/List");
}

No comments:

Post a Comment