草庐IT

invalid-request-cookie

全部标签

c# - 我可以修改 Request.Form 变量吗?

我尝试Request.Form.Set(k,v)但它抛出异常Collectionisread-only 最佳答案 这与修改Request.Querystring完全一样。两者都因私有(private)属性而在内部变得复杂,并且可以被视为错误,但是我知道有两种可能的解决方案(我会立即取消response.redirect计划-这太糟糕了)。方法一是直接使用反射修改集合:NameValueCollectionoQuery=Request.QueryString;oQuery=(NameValueCollection)Request.Ge

c# - 系统.Web.UI.ViewStateException : Invalid viewstate

我有一个使用ASP.net和C#开发的Web应用程序。我还将TelerikASP.NETAJAX用于WebUI。应用程序在生产服务器中引发异常(System.Web.UI.ViewStateException:Invalidviewstate)。它在测试服务器中运行良好。并且这个错误是随机抛出的。System.Web.UI.ViewStateException:Invalidviewstate.ClientIP:x.x.x.xPort:xxxxxReferer:http://webaddress/Page.aspxPath:/Page.aspxUser-Agent:Mozilla/4.

c# - .Net Core 中的 .AspNetCore.Antiforgery.xxxxxxx cookie 是什么?

我试图在.NetCore中使用ValidateAntiForgeryToken,但我得到的是.AspNetCore.Antiforgery.xxxxxxxcookie丢失。这个.AspNetCore.Antiforgery.xxxxxxxcookie是什么? 最佳答案 ASP.NETCore查找此cookie以找到X-CSRFtoken。TheValidateAntiForgeryTokenisanactionfilterthatcanbeappliedtoanindividualaction,acontroller,orgloba

c# - HttpClient 不保存 Cookie

我正在使用新的HttpClient来处理我的项目的网上冲浪需求;但是,尽管设置正确,但HttpClient不会将cookie保存到Cookie容器中,它始终为EMPTY。代码privateCookieContainer_cookieContainer=newCookieContainer();privateHttpClientHttpClient{get;set;}privateHttpClientHandlerHttpClientHandler{get;set;}publicInitialize(){HttpClientHandler=newHttpClientHandler{All

c# - 无法在 ASP.NET 中更新 cookie

我快疯了。我可以写入cookie,然后再读取它。但在某些时候,我想更新它所持有的值(value)。每当我再次获得cookie时,我都会得到初始值,而不是更新后的值。下面是我用于写入/更新和读取cookie的代码。privatestaticHttpCookieWriteCookie(GuidsiteId,stringsiteName){varcookie=HttpContext.Current.Request.Cookies.Get("UserSettings");if(cookie!=null){cookie.Value=EncryptObject(newUserSettingsMod

c# - request.GetResponse 总是给出超时

我为一个程序做了一个函数,当请求类型是GET时,它确实有效,如果是POST,它总是产生一个超时异常(和超时未达到50秒)在线HttpWebResponseresponse=(HttpWebResponse)request.GetResponse();我尝试了很多东西,但我没有找到原因,可能这里有人知道。编辑:让它工作,如果有人感兴趣的话:https://gist.github.com/4347248任何帮助将不胜感激。我的代码是:publicResRequestrequest(stringURL,RequestTypetyp,CookieCollectioncookies,string

c# - MVC 4 : How to maintain sessions and cookies to be still valid after IIS restart?

似乎我的登录session(使用简单成员资格)和cookie(验证token)在IIS服务器重新启动后无效。这对我来说是个问题,如果用户在交易中间然后服务器重新启动,用户必须重新填写表格并重新填写,当交易在中间中断时也可能是一些代码问题过程。如何让它们在服务器重启后仍然有效?这是我的web.config:.........更新我尝试使用SQLServer来存储session状态。然后出现新问题,我不能使用ViewBag,因为它不是Serializable。还有其他方法可以实现吗? 最佳答案 没有办法实现这个AFAIK。您始终可以使用

c# - Google OAuth2 服务帐户访问 token 请求提供 'Invalid Request' 响应

我正在尝试通过服务器到服务器方法与我的应用启用的BigQueryAPI进行通信。我已勾选此Googleguide上的所有方框在C#中尽我所能构建我的JWT。我已经对所有必要的内容进行了Base64Url编码。但是,我从google得到的唯一响应是400BadRequest"error":"invalid_request"我已经从这些其他SO问题中确定了以下所有内容:ThesignatureisproperlyencryptedusingRSAandSHA256IamusingPOSTandusingapplication/x-www-form-urlencodedcontenttype

C#:Windows 窗体:什么会导致 Invalidate() 不重绘?

我正在使用Windows窗体。很长一段时间以来,pictureBox.Invalidate();一直致力于使屏幕重绘。但是,它现在不起作用,我不确定为什么。this.worldBox=newSystem.Windows.Forms.PictureBox();this.worldBox.BackColor=System.Drawing.SystemColors.Control;this.worldBox.BorderStyle=System.Windows.Forms.BorderStyle.FixedSingle;this.worldBox.Location=newSystem.Dra

c# - 带 Cookie 的 WebRequest HTTP POST(来自 curl 脚本的端口)

IBMRTCRESTfulapi提供了一个用于向服务器进行身份验证的shell脚本示例:COOKIES=./cookies.txtUSER=my_userPASSWORD=my_passwordHOST="https://myJazzServer:9092/jazz"curl-k-c$COOKIES"$HOST/authenticated/identity"curl-k-L-b$COOKIES-c$COOKIES-dj_username=$USER-dj_password=$PASSWORD"$HOST/authenticated/j_security_check"这非常有效,但是我需