简体   繁体   English

如何在 C# 中使用 http 请求获取本地和会话存储值?

[英]How can I get local and session storage values using http request in C#?

I want to get local and session storage values from http response in C#.我想从 C# 中的 http 响应中获取本地和会话存储值。 Currently I am using this code:目前我正在使用此代码:

  var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://csdj48vyje.execute-api.us-east 1.amazonaws.com/dev/product");
        httpWebRequest.Method = "POST";
        httpWebRequest.AllowAutoRedirect = true;
        httpWebRequest.KeepAlive = true;
        httpWebRequest.ContentType = "text/plain";
        httpWebRequest.Headers.Add("Accept-Encoding", "gzip, deflate, br");
        httpWebRequest.UserAgent = "PostmanRuntime/7.26.5";
        httpWebRequest.Headers.Add("Pragma", "no-cache");
        httpWebRequest.Timeout = 40000;
        var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

localstorage and sessionstorage are data stores inside the users browser. localstoragesessionstorage是用户浏览器中的数据存储。 The values are not sent via an HTTP Request so there is no way of getting the values in the backend without explicitly sending them from the frontend.这些值不是通过 HTTP 请求发送的,因此如果不从前端显式发送它们,就无法在后端获取这些值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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