问题描述
您好:
我在ASP.Net web api控制器上设置cookie。这就是我的代码:
         
var cookie =
new
CookieHeaderValue (cookieName,cookieValue){Expires = cookieExpires,Domain
= cookieDomain, 路径= " /" };
                    
response.Headers.AddCookies( new [] {cookie});
I注意到cookie的值正在自动编码。所以"abc =="变成"abc%3d%3d"。这不会发生在常规的MVC控制器上。
 
如何防止他的编码发生?
非常感谢,
Ramon
Hello:
I am setting cookies on my ASP.Net web api controller. This is what my code looks like:
var cookie =newCookieHeaderValue(cookieName, cookieValue) {Expires = cookieExpires, Domain =cookieDomain, Path= "/"};
response.Headers.AddCookies(new[] {cookie});
I noticed the value of cookie is being automatically encoded. So "abc==" becomes "abc%3d%3d". This doesn’t happen on a regular MVC controller.
How do I prevent his encoding from happening?
Thanks a lot,
Ramon
这篇关于ASP.Net Web api cookie编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!