0

When I try to redirect to custom URI Scheme like: openURL://, the web browser directs me to a relative path: http://localhost/myServer/Main/openURL instead of displaying openURL://.

My code:

public class MainController : Controller
{
    public ActionResult MyAction()
    {
        return Redirect("openURL://");
    }
}

I also used :

public class MainController : Controller
{
    public ActionResult MyAction()
    {
        return new RedirectResult("openURL://");
    }
}

but it did not work.

tereško
  • 58,060
  • 25
  • 98
  • 150
Ala
  • 1,505
  • 1
  • 20
  • 36

1 Answers1

1

Provide a fully qualified URL :-

Instead of

return Redirect("www.google.com");

Use

return Redirect("http://www.google.com");

Edit :- As per your updated question, check these stackoverflow posts 1 , 2 , 3.

Community
  • 1
  • 1
Kartikeya Khosla
  • 18,743
  • 8
  • 43
  • 69
  • This works for (www.google.com) but it is not working for custom URLs. I have a custom URL (OpenURL:) instead of (www.google.com) – Ala Mar 23 '16 at 11:05
  • @Ala...not able to understand what do you mean by custom url..as per your question this answer will work for all external url's. – Kartikeya Khosla Mar 23 '16 at 11:06