2

I have this:

public RedirectResult LinkRedirect(string url)
{
    return Redirect(url);
}

And all it does, is redirecting me to http://mysite.com/www.externalsite.com. What am I missing here?

ojek
  • 9,680
  • 21
  • 71
  • 110

1 Answers1

4

You need to pass a url with http://prefixed to it. Then it will work

Ex: http://www.google.com

So if you want to allow your action method to accept all kind of links( with and without http prefix), you need to write little bit of code to check whether the passed the url parameter value has http prefix and if not, append it.

Shyju
  • 214,206
  • 104
  • 411
  • 497