1

我需要使用表单中的 POST 方法(不能使用 GET 抱歉)将一些数据从经典 ASP 应用程序传递到我的 ASP.NET 应用程序。

如果我的操作是目标 aspx 页面但我的 ASP.NET 应用程序正在使用表单身份验证,这似乎不起作用,因为它看起来像管道中的某个地方我的数据丢失了,因为 Request.Form 集合在我的登录页面的 Page_Load 方法。

如果我禁用表单身份验证,目标页面会毫无问题地接收发布的数据。

你知道我该如何解决这个问题吗?我何时或何处可以获得这些数据?

提前致谢!

4

3 回答 3

1

您可以取消保护作为 POST 目标的单个页面吗?

在您的 web.config 中:

<configuration>
  <location path="MyPostHandlingPage.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
</configuration>
于 2010-01-29T16:09:26.693 回答
1

一种可能是将发布的标头传输到您在 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);

}
于 2010-01-29T16:19:08.167 回答
0

在 asp 和 aspx 之间传输数据的 2 种可能方式是

  1. 使用会话,通过 SQL DB(参考http://msdn.microsoft.com/en-us/library/aa479313.aspx

  2. 在中间 ASP 页面中使用 QueryString,如下所示。

您的第一个 ASP 页面:sample.asp

<% language="VBScript"%>
<html>
<head>
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" action="process.asp" method="post">
    <div>
        &nbsp;<input name="Text1" id="Text1" type="text" />
        <input id="Submit2" type="submit" value="submit" /></div>
    </form>
</body>
</html>

您的中间页面:process.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 代码页:Default.aspx

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(Request.QueryString["icontent"].ToString());
    }

}
于 2009-12-13T06:50:59.570 回答