简体   繁体   中英

Create new cookie to edit its value

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 HttpCookie("cleanedFacebookCookie", cleanValue);

gayness

说将值读入局部变量并在那里执行任何操作是否太简单了?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM