Here's my scenario:
这是我的情景:
A desktop application posts to a specific ASP page in my web application with XML data. The web application is being re-written to ASP.Net; however, the Url for that specific page can not change (due to the desktop application).
桌面应用程序使用XML数据发布到我的Web应用程序中的特定ASP页面。 Web应用程序正在重写为ASP.Net;但是,该特定页面的Url无法更改(由于桌面应用程序)。
My original idea was to simply 'forward' the requests from the classic ASP page to a new ASPX page, which would handle the request, by changing the ASP page like so:
我最初的想法是简单地将来自经典ASP页面的请求“转发”到新的ASPX页面,该页面将处理请求,通过更改ASP页面如下:
<% Server.Transfer("MyApp/NewXmlHandler.aspx") %>
However, this doesn't work:
但是,这不起作用:
Active Server Pages error 'ASP 0221' Invalid @ Command directive /MyApp/NewXmlHandler.aspx, line 1
Active Server Pages错误'ASP 0221'无效@ Command指令/MyApp/NewXmlHandler.aspx,第1行
Is there a simple way I can take the posted data in the ASP page, and forward it on to another page?
有没有一种简单的方法可以在ASP页面中获取发布的数据,并将其转发到另一个页面?
Thanks!
4 个解决方案
#1
Put the form values into querystrings (URL encode them) and then use Response.Redirect instead. Server.Transfer resumes execution and you cannot execute an ASP.NET page in ASP 3.0.
将表单值放入查询字符串(URL编码),然后使用Response.Redirect。 Server.Transfer恢复执行,您无法在ASP 3.0中执行ASP.NET页面。
#2
In case anyone else runs into this, I ended up passing the request along like so:
如果其他人遇到这种情况,我最终会像这样传递请求:
<%
Dim postData
Dim xmlhttp
'Forward the request to let .Net handle
Set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://127.0.0.1/MyApp/NewXmlHandler.aspx",false
xmlhttp.send(Request)
Response.Write xmlhttp.responseText
Set xmlhttp = nothing
%>
#3
Can you use ASP.NET routing? If so, just route the POST to the .aspx page instead of the .asp page.
你可以使用ASP.NET路由吗?如果是这样,只需将POST路由到.aspx页面而不是.asp页面。
#4
I'm working on a similar problem just like this one but i have to deal with authorization also. In your case it is much simpler and for those who might run into this problem, I think URLRewrite or .htaccess will do the trick.
我正在研究类似这样的问题,但我也必须处理授权问题。在你的情况下,它更简单,对于那些可能遇到这个问题的人,我认为URLRewrite或.htaccess会做到这一点。
#1
Put the form values into querystrings (URL encode them) and then use Response.Redirect instead. Server.Transfer resumes execution and you cannot execute an ASP.NET page in ASP 3.0.
将表单值放入查询字符串(URL编码),然后使用Response.Redirect。 Server.Transfer恢复执行,您无法在ASP 3.0中执行ASP.NET页面。
#2
In case anyone else runs into this, I ended up passing the request along like so:
如果其他人遇到这种情况,我最终会像这样传递请求:
<%
Dim postData
Dim xmlhttp
'Forward the request to let .Net handle
Set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://127.0.0.1/MyApp/NewXmlHandler.aspx",false
xmlhttp.send(Request)
Response.Write xmlhttp.responseText
Set xmlhttp = nothing
%>
#3
Can you use ASP.NET routing? If so, just route the POST to the .aspx page instead of the .asp page.
你可以使用ASP.NET路由吗?如果是这样,只需将POST路由到.aspx页面而不是.asp页面。
#4
I'm working on a similar problem just like this one but i have to deal with authorization also. In your case it is much simpler and for those who might run into this problem, I think URLRewrite or .htaccess will do the trick.
我正在研究类似这样的问题,但我也必须处理授权问题。在你的情况下,它更简单,对于那些可能遇到这个问题的人,我认为URLRewrite或.htaccess会做到这一点。