3

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).

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:

<% Server.Transfer("MyApp/NewXmlHandler.aspx") %>

However, this doesn't work:

Active Server Pages error 'ASP 0221' Invalid @ Command directive /MyApp/NewXmlHandler.aspx, line 1

Is there a simple way I can take the posted data in the ASP page, and forward it on to another page?

Thanks!

casperOne
  • 73,706
  • 19
  • 184
  • 253
John
  • 17,163
  • 16
  • 65
  • 83

4 Answers4

2

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.

Keith Adler
  • 20,880
  • 28
  • 119
  • 189
  • I think the two potential issues here are 1) is there a length limit for a url? and 2) I don't know if the desktop application could respond to a redirect request – John Jul 14 '09 at 20:31
  • 1
    Well, another solution would be to put them into the session and share the session: http://msdn.microsoft.com/en-us/library/aa479313.aspx – Keith Adler Jul 14 '09 at 20:53
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
%>
John
  • 17,163
  • 16
  • 65
  • 83
0

Can you use ASP.NET routing? If so, just route the POST to the .aspx page instead of the .asp page.

Matthew Groves
  • 25,181
  • 9
  • 71
  • 121
0

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.