繁体   English   中英

当发布调用进入 webform 应用程序中的页面时,会话被重置

[英]Session gets reset when a post call comes to the page in webform application

我有一个基于 ASP.Net 4.7 的 webform 应用程序,要求是在某个页面上,我需要使用一些参数将表单提交到我的应用程序外部的 url(External Url),我需要发送一个返回 url(它将是我的应用程序的当前页面),在该页面上运行的应用程序(外部 URL)将处理通过表单传入的数据,并重定向到返回 url,现在的问题是何时在我的应用程序的应用程序会话中收到该 post 回调被重置和所有数据都丢失了,我可以在上下文中看到会话 ID 与以前不同,并且由于我的验证,我的应用程序将其重定向到登录页面。 任何人都可以帮助为什么我的会话被重新生成。

这些是我的 web.config 设置。

    <sessionState 
  mode="InProc" 
  timeout="200" 
  cookieless="false" 
  cookieSameSite="Lax"
/>

这就是我发布数据的方式。

System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head>");
System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, "POST", ExternalUrl));
System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", "Var1", Var1));
System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", "ReturnUrl", CurrentApplicationUrl));
System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", "Var2", Var2));
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");

HttpContext.Current.Response.Flush(); // 
HttpContext.Current.Response.SuppressContent = true;  
HttpContext.Current.ApplicationInstance.CompleteRequest(); 

我有同样的问题。 经过多天的反复试验,我发现 IIS Express 使用的本地主机证书与我的本地 IIS 使用的证书之间存在证书冲突。 我必须从“个人”/“证书”文件夹和 MMC 中的“受信任...”/“证书”文件夹中删除由 RSA 颁发的证书(以管理员身份运行)。 代码很好。 冲突在于两个证书都在证明“localhost”。 希望这可以帮助。

暂无
暂无

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

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