0

html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>TestGamePlay</title>
    <link href="/Content/Site.css" rel="stylesheet" type="text/css" >
    <script src="/Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>

</head>
<body>

<div id="js1">
</div>
<span><a data-ajax="true" data-ajax-method="Post" data-ajax-mode="replace" data-ajax-update="#js1" href="/Kamikaze2/Start?cost=5&amp;gameId=84cada66-c01b-419d-9df3-620663a1dc8d">5</a></span> 
</body>
</html>

コントローラ:

[AjaxOnly]
        public ContentResult Start(int cost, Guid gameId)
        {
return new ContentResult() { Content = "Start game" };
}

ajax のみの属性

public class AjaxOnlyAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (!filterContext.HttpContext.Request.IsAjaxRequest())
            filterContext.HttpContext.Response.Redirect("/");
    }

    public override void OnActionExecuted(ActionExecutedContext filterContext)
    {

    }
}  

mozile ではすべて正常に動作します。the Opera(v. 11.62) "/" にリダイレクトします

何が原因でしょうか

4

1 に答える 1

0

私は自分のコンピュータを再起動し、それは働いた

于 2012-05-04T05:19:40.123 に答える