2013-10-27 59 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"); 

,并开始工作。