2013-10-27 54 views
0

當我在VS 2013中測試樣本時,它們與localhost一起工作良好,或者從localhost訪問時 - cookie生成良好並保存在localhost中。OWIN Cookie和IP地址

然後我想在iPad上做一些測試,所以我啓用了IISExpress上的IP地址訪問。當我通過IP地址10.0.0.x:port訪問我的測試網站時,不提供cookie。

我有股票的標準線:

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

我怎樣才能「名」我的MS身份cookie的使用,這樣不管瀏覽器正在訪問的域名「localhost」的「IP」或「XXXX」的那它仍然會工作?

回答

1

我不知道爲什麼這最初不起作用。我仍然在玩這個。但我改變了啓動餅乾配置到(在Startup.Auth.cs):

app.UseCookieAuthentication(new CookieAuthenticationOptions 
{ 
     AuthenticationType = "ABC", 
     LoginPath = new PathString("/Account/Login"), 
     CookieName = "ABC" 
    }); 

然後我修改的簽到(IdentityModels.cs)以下行

var identity = manager.CreateIdentity(user, "ABC"); 

,並開始工作。