jeudi 18 juin 2015

Redirect returns "Object moved to"

I have a problem. When I try to redirect user to non-http URL from MVC action, it returns:

Object moved to here.

Full response (from Fiddler):

HTTP/1.1 301 Moved Permanently
Cache-Control: private
Content-Type: text/html; charset=utf-8
Location: myGame-app://test.somespecificdata
Server: Microsoft-IIS/8.0
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcUGlvdHJcRGVza3RvcFxUYWtlc0NhcmVcVGFrZXNDYXJlXERvY3RvcnNcRWRvY3RvclxDb25zdWx0YXRpb25cMTkx?=
X-Powered-By: ASP.NET
Date: Thu, 18 Jun 2015 18:19:35 GMT
Content-Length: 457

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="myGame-app%3a%2f%2ftestprotocol.somespecificdata">here</a>.</h2>

<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
<script type="text/javascript" src="http://localhost:53098/4c9c75263d91451fa797f9041e4bd0f3/browserLink" async="async"></script>
<!-- End Browser Link -->


My action (with pseudo code):

public ActionResult Consultation(int id)
      //.. specific business logic
          return RedirectPermanent("myGame-app://test.somespecificdata"); 
          return View("AboutGame", SomeSpecificModel);

The same situation is with return Redirect() instead of return RedirectPermanent().

My main goal is to redirect a user who uses the mobile browser to URL with special protocol (not http). This special protocol (myGame-app://) runs my mobile app according to this Stack discussion. How can I achieve this, without information Object moved to here?


Aucun commentaire:

Enregistrer un commentaire