Classic ASP error with XMLHTTP request

I am running Classic ASP along with ASP.net 4.0 on IIS 7.5.

There is code in my classic ASP code:

' Process @ alerts Dim objHttp set objHttp = Server.CreateObject("Microsoft.XMLHTTP") objHttp.open "POST", strSiteRoot & "handlers/forumalerts.ashx?", false objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded" objHttp.Send "topicID=" & lngTopicID & "&threadID=" & lngLastPostID set objHttp = nothing 

This sends the request to the ASP.NET ASHX handler. When it starts, it freezes for a long time before finally sending an error message:

Error msxml3.dll '800c0008'

Failed to load the specified resource.

/forum/new_post.asp line 1036

I checked the url to which it is sent and it exists and works. Corrected data is also correct.

Before I updated Windows 7, it worked fine. Since reinstalling it again and configuring IIS again, this bit of code fails, which leads me to believe that this is a permission / identity error.

Can someone tell me what could be causing this? I have 3 application pools:

 ASP.net v4.0 (Integrated) (ApplicationPoolIdentity) ASP.net v4.0 Classic (Classic) (ApplicationPoolIdentity) DefaultAppPool (Integrated) (NetworkService) 

Thanks for any help!

Edit: I found this error in the logs:

 Event code: 3005 Event message: An unhandled exception has occurred. Event time: 02/11/2011 14:55:42 Event time (UTC): 02/11/2011 14:55:42 Event ID: 4e550d910b934d2781707701f833e18e Event sequence: 39 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/1/ROOT-2-129647191892089824 Trust level: Full Application Virtual Path: / Application Path: C:\inetpub\wwwroot\ScirraNew\ Machine name: TOM-PC Process information: Process ID: 7980 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: ArgumentNullException Exception message: Value cannot be null. Parameter name: String at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at forumalerts.ProcessRequest(HttpContext context) in c:\inetpub\wwwroot\ScirraNew\Handlers\forumalerts.ashx:line 13 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Request information: Request URL: http://127.0.0.1/handlers/forumalerts.ashx Request path: /handlers/forumalerts.ashx User host address: 127.0.0.1 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 39 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: True Stack trace: at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at forumalerts.ProcessRequest(HttpContext context) in c:\inetpub\wwwroot\ScirraNew\Handlers\forumalerts.ashx:line 13 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Custom event details: 

Line 13 is the first request.form:

 int TopicID = int.Parse(context.Request.Form["topicID"]); 
+6
source share
4 answers

If I understand correctly, you are making a request to the same server as the caller.

Read http://support.microsoft.com/kb/316451

Using ServerXMLHTTP or WinHTTP objects to create recursive hypertext Transfer Protocol (HTTP) requests for the same information on the Internet Server Server (IIS) is not recommended. More specifically, an Active Server Page (ASP) call should not send requests to ASP in the same virtual directory or another virtual directory in the same pool or process. This can lead to poor performance due to thread fasting.

+4
source

The first step is to stop using Microsoft.XMLHTTP , you should not use it in a base station script. Instead, use MSXML2.ServerXMLHTTP.3.0 , which is intended for use in services.

In addition, if the .ashx message sent by inturn is returned back to the original ASP application, then there is a hunger problem in the thread, in which Gaby may be present. You can usually get away with this on a site with easy use. However, if you have ASP debugging turned on in your application, then calling back to the ASP application will definitely hang. Note that this does not apply to a simple ASP script for ASHX.

If your problem persists (which is likely to be), then:

  • install a copy of fiddler on your computer.
  • Fire feedler
  • At the command prompt, type >netsh
  • Problem with the command >winhttp set proxy 127.0.0.1:8888
  • Try using the ASP page, you should see a POST shot by fiddler
  • Restore winhttp proxy settings with >winhttp reset proxy

Now consider the POST request / response in a script, this may show some hints as to where the real problem lies.

+4
source

I am new to ASP classic.

But perhaps the requested page sends a response to the first page and waits for it to be received, the first page does not receive it, so an error occurs.

Try using the following after objHttp.Send :

objHttp.ResponseText

Oh, I found a probable error in this line now:

objHttp.open "POST", strSiteRoot & "handlers/forumalerts.ashx?", false

Try using the string " handlers/forumalerts.ashx? " Without "?" in the end.

0
source

I am replacing: Server.CreateObject("MSXML2.XMLHTTP") with Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")

and then the error is not displayed again.

0
source

Source: https://habr.com/ru/post/900391/


All Articles