我試圖讓我的頭在使用OWIN。我創建了兩個MVC 5項目。一個使用Aspnet.Identity進行身份驗證,另一個開始爲空項目。MVC 5重定向到登錄頁面不與OWIN一起使用
添加以下到emptyp項目:
與登錄操作帳戶控制器和視圖coresponding
Startup.cs與
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "ApplicationCookie",
LoginPath = new PathString("/Account/Login")
});
}
}
我在Home控制器中用[作者ize]屬性。
當我在運行第一個項目並在登錄之前轉到關於屏幕,重定向到登錄操作。當我爲第二個項目做同樣的事情時,我得到一個「HTTP錯誤401.0 - 未經授權」而不是重定向。
任何想法會導致第二個行爲這樣?
有比你在web.config兩個項目之間? –
我已經比較了兩個web.config文件,但我會再次執行並報告回來...... – Jeff
@AlexDresko,感謝您的幫助。我在昨天錯過的web.config中發現了一些不同之處。不幸的是,它並沒有幫助解決問題。 – Jeff