OWIN
南希
Web API 2
而我正在使用Katana的Microsoft.Owin.Security.cookies来进行表单验证.我收到了Set-cookie标头,但是cookie并没有被保存,也没有包含在下一个请求中.所以有什么问题?我做错了什么?
欧文启动:
app.UsecookieAuthentication(new cookieAuthenticationoptions() { AuthenticationMode = AuthenticationMode.Active,AuthenticationType = "GM",cookiehttpOnly = true,cookieSecure = cookieSecureOption.SameAsRequest,cookiePath = "/",cookiename = cookieAuthenticationDefaults.cookiePrefix + "GM",cookieDomain = "localhost",});
控制器代码:
var context = Request.GetowinContext();context.Authentication.SignIn(new AuthenticationPropertIEs() { IsPersistent = true },new ClaimsIDentity(new[] {new Claim(ClaimsIDentity.DefaultnameClaimType,user.Login)},"GM"));context.Response.headers.Add("Location",new []{ "/" });return Request.CreateResponse(httpStatusCode.Found);
响应标题:
Cache-Control:no-cacheContent-Length:0Date:Wed,11 Sep 2013 11:11:23 GMTExpires:-1Location:/Pragma:no-cacheServer:Microsoft-httpAPI/2.0Set-cookie:.AspNet.GM=AQAAANCMnd8BFdERjHoAwE_Cl-sBAAAABui2rBibE0yPXB0-v3C06gAAAAACAAAAAAAQZgAAAAEAACAAAAC1mQV3jGo_WAhMQ-hzsmzgkdbdcclWIAX-msbE0_12zQAAAAAOgAAAAAIAACAAAABuQjBg3EJIka151hvBgtlPGfQ2O_cwNI2VVh86dchTDXAAAAD21O9DnNk4yLU9eddVfY3bT9P1CEudNeLvwohkSTAQBP2onuIQfgl9F99Je5waPddckh2llD2kjftSMQPhzgE9vKm-_wE42hXhc9figfxpD5AdaeGatwpEcwDfGJJdpQnObX1pbjEFIXLVJxGm5qMUQAAAAC8aifTaXmzrfRy4-jR6zqMmSKddzddmiBLGClAckWOy6W2YWdf50N2zhIj_MwN8-zi-B0tlv87pzAt-6RDZYZs; domain=localhost; path=/; expires=Wed,25-Sep-2013 11:11:24 GMT; httpOnly解决方法 我解决了这个问题.这是因为’domain = localhost’. ‘localhost’似乎不是域参数的有效值. 总结
以上是内存溢出为你收集整理的cookie – Owin cookie认证set-cookie不保存在浏览器中全部内容,希望文章能够帮你解决cookie – Owin cookie认证set-cookie不保存在浏览器中所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)