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?

6
  • 2
    possible dub. stackoverflow.com/questions/1549324/… Commented Mar 21, 2013 at 13:22
  • How is your link helping me? I have exactly the same code that was posted there, and it does not work for me! Commented Mar 21, 2013 at 13:24
  • Are you passing a url with prefixed to it ? Commented Mar 21, 2013 at 13:24
  • is url formatted like myexternalsite.com ? Commented Mar 21, 2013 at 13:25
  • No. Passed url is clear, like "www.sth.com" or "sth.com" etc. Commented Mar 21, 2013 at 13:25

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh well, that sucks, but okay, will do it, thanks for helping. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.