after some tries to fix it I didn't get any success... so I decided to go other way and prepared some kind of custom redirection through the redirect page that does the JavaScript location change.
Here is the code...
Helper method:
public static void CustomRedirect(this HttpResponseBase response, string url)
{
string customRedirectPage = ConfigurationManager.AppSettings["custom_redirect_page"];
if (string.IsNullOrEmpty(customRedirectPage))
response.Redirect(url);
else
{
byte[] bytesToEncode = Encoding.UTF8.GetBytes(url);
string base64 = Convert.ToBase64String(bytesToEncode);
response.Redirect(string.Format("{0}?url={1}", customRedirectPage, base64));
}
}
Web.config:
<add key="custom_redirect_page" value="/Redirect/RedirectTo"/>
Controller:
public ActionResult RedirectTo(string url)
{
return View((object)System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(url)));
}
And HTML:
@section Scripts {
<script type="text/javascript">
$(document).ready(function () {
var url = '@Html.Raw(Model)';
window.location = url;
});
</script>
}
Don't like this kind of hacks but that worked for me...