ASP Classic页面出现Accept */*错误,服务器迁移后求助排查
First, let's break down what we know: your ASP Classic site loads fine for regular clients and bots, but you're getting repeated "Object required" error emails for /entries.asp from requests with an MSIE 7 user agent and a specific session cookie. Since bot requests (with a fresh session cookie) work without issues, the problem is almost certainly tied to session state differences or browser-specific behavior on your new IIS 8.5 server.
What "Object required" Means in ASP Classic
This error nearly always stems from one of three scenarios in your code:
- You're trying to call a property/method of an object that wasn't properly initialized (e.g.,
Set obj = Nothingbefore usingobj.DoSomething()) - A session/application variable that's supposed to hold an object is either empty or set to a non-object value (like a string or number)
- A server-side COM component failed to load on the new server, so
Server.CreateObject()returnedNothingbut your code still tries to use it
Key Clues From the Request Differences
Let's compare the error-triggering request and the working bot request to spot patterns:
- Error request: MSIE 7 user agent, existing session cookie (
ASPSESSIONIDSEQCBTBC=HAHPCOABKDGFLKDBPFDDCCDO), nosecureflag on the cookie in the request - Bot request: Non-IE user agent, fresh session cookie with a
secureflag attached, full 200 OK response
The new server is setting session cookies with the secure flag—a setting that MSIE 7 has well-documented issues with, especially if your site isn't using HTTPS. Even though the error request has a cookie, the session state might be corrupted or incomplete for IE 7 clients.
Step-by-Step Troubleshooting & Fixes
1. Get Exact Error Details (Line Number Included)
First, stop guessing and get precise information about where the error occurs:
- In IIS Manager, navigate to your site > ASP > expand Error Properties
- Temporarily set Send Errors To Browser to
True(don't leave this on in production) - Enable Error Logging and specify a log path
- Simulate the IE 7 request using Postman or curl (copy the exact UA and cookie from your error email) to see the full error, including the line number in
entries.aspthat triggers the issue
2. Audit Session-Dependent Object Usage
Since the error is tied to an existing session cookie, your code is likely relying on a session-stored object that's missing or corrupted for IE 7 users:
- Scan
entries.aspfor references toSession("SomeObject")(e.g., user profiles, shopping carts, cached data components) - Add validation checks before using these objects to ensure they exist and are valid:
' Example: Verify a session object is initialized before use If Not IsObject(Session("UserProfile")) Then ' Re-initialize the object if it's missing Set Session("UserProfile") = Server.CreateObject("MyApp.UserProfile") Session("UserProfile").Load(Request.Cookies("SavedUserID")) ' Log this recovery step for debugging Call WriteLog("Re-initialized UserProfile for session: " & Session.SessionID) End If
3. Fix Session Cookie secure Flag Conflicts
IE 7 ignores secure cookies when accessing a site over HTTP. If your new server is forcing secure cookies but you haven't migrated to HTTPS yet, this can break session persistence for IE 7:
- In IIS Manager, go to your site > Session State
- Under Cookie Settings, uncheck Require SSL (only skip this if you're not using HTTPS; re-enable it once you switch)
- Restart the site to apply the change
4. Validate COM Component Dependencies
The new server might be missing a COM component your code relies on. Even if bots work, IE 7 requests could trigger code paths that use the missing component:
- Check all
Server.CreateObjectcalls inentries.asp - Verify the components are installed and registered on the new server (use
regsvr32.exefor manual registration if needed) - Add error handling around object creation to catch failures:
Dim objDataLayer On Error Resume Next Set objDataLayer = Server.CreateObject("MyApp.DataLayer") If Err.Number <> 0 Then Call WriteLog("Failed to create DataLayer component: " & Err.Description) ' Add fallback logic here (e.g., use a default dataset) End If On Error GoTo 0
5. Check for IE 7-Specific Code Paths
Your code might have browser-specific logic that breaks on the new server. Search for checks like:
If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE 7") > 0 Then ' IE 7-specific code that uses an uninitialized object End If
Audit these sections to ensure all objects are properly initialized before use.
Final Note
Once you fix the issue, remember to disable "Send Errors To Browser" in IIS for production to avoid exposing sensitive code details to users.
内容的提问来源于stack exchange,提问作者H.L.

