ASP.NET - 在表单身份验证的 loginUrl 中接收 HTTP POST 数据(来自外部应用程序)
-
19-09-2019 - |
题
我需要使用表单中的 POST 方法(抱歉,不能使用 GET)将一些数据从经典 ASP 应用程序传递到我的 ASP.NET 应用程序。
如果我的操作是目标 aspx 页面,但我的 ASP.NET 应用程序正在使用表单身份验证,这似乎不起作用,因为它看起来像管道中的某个地方,我的数据丢失了,因为 Request.Form 集合在我的登录页面的Page_Load方法。
如果我禁用表单身份验证,目标页面会毫无问题地接收发布的数据。
你知道我该如何解决这个问题吗?我何时何地可以获得这些数据?
提前致谢!
解决方案
有一个可能性是张贴的头转移到那时,将被杀死你在你的ASPX侧保持会话对象,一旦其目的是完整的。
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
SortedList sList = new SortedList();
foreach (string key in HttpContext.Current.Request.Form.Keys)
{
sList.Add(key, HttpContext.Current.Request.Form[key]);
}
Session.Add("myList", sList);
}
其他提示
您可以只取消该单页是这样的职位?
目标在你的web.config:
<configuration>
<location path="MyPostHandlingPage.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
</configuration>
在 asp 到 aspx 之间传输数据的 2 种可能的方法是
使用会话,通过 SQL DB(参考文献 1) http://msdn.microsoft.com/en-us/library/aa479313.aspx
在中间 ASP 页面中使用 QueryString,如下所示。
您的第一个 ASP 页面:样本.asp
<% language="VBScript"%>
<html>
<head>
<title>Untitled Page</title>
</head>
<body>
<form id="form1" action="process.asp" method="post">
<div>
<input name="Text1" id="Text1" type="text" />
<input id="Submit2" type="submit" value="submit" /></div>
</form>
</body>
</html>
您的中间页面:进程.asp
<%@ language="vbscript"%>
<html>
<head>
<title>Untitled Page</title>
</head>
<body>
<form id="form2">
<%response.Write(Request.Form("Text1"))
%>
<%response.Redirect("default3.aspx?icontent=" & Request.Form("Text1")) %>
</form>
</body>
</html>
您的 ASPX 代码页:默认.aspx
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.QueryString["icontent"].ToString());
}
}
不隶属于 StackOverflow