Simon Legg
Simon Legg

Reputation: 939

Redirect to external url - link works in browser but not redirect method

With reference to .net mvc redirect to external url.

So you have your controller setup with the redirect as below:

public ActionResult SiteDetails(short id)
{
   return Redirect("localhost:1234/Controller/Action");
}

BUT
- nothing happens when you call the action.
- Expecting a redirect and nothing happens.
- Expecting a redirect to another MVC site and nothing happens.
- Not only that - in debug the string url going into the redirect works when copied into the browser.

Why doesn't this work?

Upvotes: 0

Views: 644

Answers (1)

Simon Legg
Simon Legg

Reputation: 939

Requires 'http://' within the string.

public ActionResult SiteDetails(short id)
{
   return Redirect("http://localhost:1234/Controller/Action");
}

Upvotes: 2

Related Questions