记录工作中遇到的一些Cookie设置的问题:
-
异常:参数“{0}”不能是空字符串。参数名: cookie.Domain
解决方案:在Cookie设置中加上你访问的域名,例:将Cookie设置
Cookie c1 = new Cookie("name_xxxx","value_xxxx");
修改为
Cookie c1 = new Cookie("name_xxxx","value_xxxx", "/", ".***.com");
-
异常:cookie 的“Value”=“xxxxx,xxxxx”部分无效
解决方案:在使用的时候可以将逗号替换为%2C写入Cookie中 。例:
Cookie c1 = new Cookie("test","45,46");
需要修改为
Cookie c1 = new Cookie("test","45%2C46");
标签:xxxx,C#,Cookie,设置,new,c1,xxxxx From: https://www.cnblogs.com/yellow3gold/p/17308608.html