开发者

Create new cookie to edit its value

开发者 https://www.devze.com 2023-01-13 06:07 出处:网络
I know that you can\'t edit incoming cookies.I have a cookie that I just need to read..nothing more but I have a need to remove some characters from its value so that I can parse it.How can I do this?

I know that you can't edit incoming cookies. I have a cookie that I just need to read..nothing more but I have a need to remove some characters from its value so that I can parse it. How can I do this? I don't need to send the modified new cookie back in the response, it's just for my server-side consumption and then that's it.

Updated:

figured it out:

    HttpCookie facebookAuthCookie = HttpContext.Current.Request.Cookies[facebookCookieName];
    string cleanValue = facebookAuthCookie.Value.Replace("\"", string.Empty);

    HttpCookie cleanedFacebookAuthCookie = new HttpCo开发者_如何学运维okie("cleanedFacebookCookie", cleanValue);

gayness


Is it too simple to say read the values into a local variable and do whatever you want there?

0

精彩评论

暂无评论...
验证码 换一张
取 消