MVC Redirect user protocol works in Chrome but not in IE

I have an ActionResult that returns a redirect:

        public ActionResult TeamviewerConnect(int id)
        {
          snipped ...
            return Redirect("impacttv://" + Endpoint.tbl_computerinfo.FirstOrDefault().teamviewerID + "::" + teamviewerPassword);
        }

impacttv: // is a custom protocol and works fine in both IE and Chrome as a standard link.

This works fine in Chrome, but 404s in IE - who has an idea?

+4
source share
1 answer

See: Error redirecting to native URL protocol .

I know that some time has passed since you asked, but this blog post describes the redirection behavior for user protocols.

The bad news is that redirects do not work for IE.

, IE . -, JavaScript window.location.

, MVA WebApi AJAX, Uri, , "" . , .

MVC WebApi

Mvc WebApi nuget , , , : p

TvController.cs

public class TVController: ApiController 
{
    [HttpGet]
    public string TeamviewerConnectUri(int id)
    {
        return "impacttv://" + Endpoint.tbl_computerinfo.FirstOrDefault().teamviewerID + "::" + teamviewerPassword;
    }
}

JS ( jQuery, MVC)

var apiUrl = '/api/tv/TeamviewerConnectUri';

$.get(apiUrl, {id: 1 })
    .then(function(uri)) {
        window.location = uri;
        // window.open(uri);
    });

MVC

TvController.cs

public class TVController: ApiController 
{
    [HttpGet]
    public ActionResult TeamviewerConnectUri(int id)
    {
        return Json(new {uri = "impacttv://" + Endpoint.tbl_computerinfo.FirstOrDefault().teamviewerID + "::" + teamviewerPassword}, JsonRequestBehavior.AllowGet);
    }
}

JS ( jQuery, MVC)

var apiUrl = '/tv/TeamviewerConnectUri';

$.get(apiUrl, {id: 1 })
    .then(function(data)) {
        window.location = data.uri;
        // window.open(data.uri);
    });
+3

All Articles