tags:

views:

57

answers:

3

I am attempting to call an ASP.NET page from a classic ASP page on the same machine. The ASP page is located in c:\inetpub\wwwroot. The ASP.NET page is located in C:\Inetpub\wwwroot\WebServiceWrapper\

Here is the ASP code to call the page:

Dim objHttp, strQuery
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
strQuery = "http://localhost/WebServiceWrapper/CalledFromAsp.aspx?First=Steve&Last=Smith&DOB=11/25/2001&Gender=M"
objHttp.open "POST", strQuery, false
objHttp.send
Set objHttp = Nothing

The ASP.NET code, which calls a web service and sets a cookie, works if I call it from the browser directly. However, using the Msxml2.ServerXMLHTTP object, it does not. The cookie is not generated and there is no error. There are no events in Event Viewer.

The ASP.NET page was developed in Visual Studio 2005, .NET 2.0. Changing the POST to a GET has not helped.

Any ideas?

A: 

Have you tried redirecting via the client's browser?

Response.Redirect "http://localhost/WebServiceWrapper/CalledFromAsp.aspx?First=Steve&Last=Smith&DOB=11/25/2001&Gender=M"
Christian Hayter
@Downvoter: I suppose an explanation would be out of the question?
Christian Hayter
A: 

Your request to the web service is being made by your server, not the user's browser. The cookie is returned to the .asp page in the response headers. You need to parse it out and set it on the user's browser via Response.Cookies("cookieName") = value

Scott Mayfield
A: 

If you are trying to redirect the user to the ASP.NET page, use Response.Redirect.

If you just want to call the ASP.NET page to set the cookie when the user visits your ASP page, you can use an small and invisible iframe. Just set the iframe target to your ASP.NET page.

Of course, you could always call the webservice directly from your ASP code and set the cookies there.

Ed B