cookie 的“Value”=“xxxxx,xxxxx”部分无效

还有这事儿,得转(转自:http://www.qq7u.com/develop/itDev/2721.html): 在一些网站中有时候会遇到Cookie的值为逗号 但是在.Net中Cookie的值是不能直接使用逗号的 如果使用形如 C#代码 1.Cookie cookie=new Cookie("name","xxxxx,xxxxx"); Cookie cookie=new Cookie("name","xxxxx,xxxxx"); 会报错 C#代码 1.Cookie 的“Value”=“xxxxx,xxxxx”部分无效 Cookie 的“Value”=“xxxxx,xxxxx”部分无效 解决方法: 那么在使用的时候可以将逗号替换为,写入Cookie中 C#代码 1.Cookie cookie=new Cookie(); 2.cookie.Name="name"; 3.cookie.Value="xxxxx,xxxx"; Cookie cookie=new Cookie(); cookie.Name="name"; cookie.Value="xxxxx,xxxx"; 或者 C#代码 1.Cookie cookie=new Cookie("name","xxxx%2Xxxxx");
发布了172 篇原创文章 · 获赞 3 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/sizheng0320/article/details/6008836