1

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?

1
  • So the request to CalledFromAsp.aspx is intended to set the cookie? The request is coming from the server though not the browser so any cookie that gets sent back won't get passed onto the browser. Commented Jun 3, 2010 at 15:04

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

-1

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"

1 Comment

@Downvoter: I suppose an explanation would be out of the question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.