이 문제가 논의되는 사이트가 여러 곳 있습니다. 해결책은 플래시의 다른 게시 변수를 사용하여 승인 정보를 다시 MVC로 수동으로 전달하는 것입니다. 내가 찾은 구현은 TokenizedAuthorizeAttribute
입니다.
/// <summary>
/// A custom version of the <see cref="AuthorizeAttribute"/> that supports working
/// around a cookie/session bug in Flash.
/// </summary>
/// <remarks>
/// Details of the bug and workaround can be found on this blog:
/// http://geekswithblogs.net/apopovsky/archive/2009/05/06/working-around-flash-cookie-bug-in-asp.net-mvc.aspx
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class TokenizedAuthorizeAttribute : AuthorizeAttribute
{
/// <summary>
/// The key to the authentication token that should be submitted somewhere in the request.
/// </summary>
private const string TOKEN_KEY = "AuthenticationToken";
/// <summary>
/// This changes the behavior of AuthorizeCore so that it will only authorize
/// users if a valid token is submitted with the request.
/// </summary>
/// <param name="httpContext"></param>
/// <returns></returns>
protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
{
string token = httpContext.Request.Params[TOKEN_KEY];
if (token != null)
{
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(token);
if (ticket != null)
{
FormsIdentity identity = new FormsIdentity(ticket);
string[] roles = System.Web.Security.Roles.GetRolesForUser(identity.Name);
GenericPrincipal principal = new GenericPrincipal(identity, roles);
httpContext.User = principal;
}
}
return base.AuthorizeCore(httpContext);
}
}
덧글에있는 Link 다음에 더 도움이 될 것입니다.
은 모든 결과를 확인하는 외부 보안 meganism이없는 경우 작동합니다. – Patrick
당신이 의미하는 것을 얻지 못합니다. – DanielB
특정 쿠키에 대한 모든 요청을 확인하는 ID 서버를 사용합니다. 해당 쿠키가 없으면 연결을 종료합니다. – Patrick