2016-04-15 9 views
0

DotvvmでCookie認証を使用すると、Nullユーザー例外がスローされます。Owin CookieでNullユーザー例外がDotvvmでの認証

私はdotvvm構成で、次のコードを使用:

{ 
     AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
     LoginPath = new PathString("/Account/Login") 
    }); 

答えて

0

を、次の認証コードが設定(IAppBuilderアプリ)関数の最初の行でなければならず、それがnullのユーザ例外を取り除くになります。

{ 
     AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
     LoginPath = new PathString("/Account/Login") 
    }); 
0

またProviderプロパティを設定し、OnRedirectを扱う、そうでない場合はOWINセキュリティライブラリによって作られたリダイレクトが正しく適用されませんことをお勧めします。

app.UseCookieAuthentication(new CookieAuthenticationOptions() 
{ 
    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
    LoginPath = new PathString("/login"), 
    Provider = new CookieAuthenticationProvider() 
    { 
     OnApplyRedirect = e => DotvvmAuthenticationHelper.ApplyRedirectResponse(e.OwinContext, e.RedirectUri) 
    } 
}); 
関連する問題