i have a function and i am unclear what i should return from this?
public ActionResult LoadExternalURL()
{
Response.Redirect("http://www.google.com");
// what do i return here ??
}
i have a function and i am unclear what i should return from this?
public ActionResult LoadExternalURL()
{
Response.Redirect("http://www.google.com");
// what do i return here ??
}
Instead of calling Response.Redirect it's easier to use the built in RedirectResult ActionResult as follows:-
return Redirect("http://www.google.com");
This will also improve the testability of your code (you don't have to muck around mocking the HTTP context) and instead you can just test the Url property of the returned action result.