Opening ASP page causes file download dialog instead

N

Neil Rossi

I have an issue with a particular ASP page on two web servers. Let's
call these servers Dev1 and Beta1. Both Servers are running IIS 5,
Windows 2000 SP4 with "almost" all of the latest patches.

On Beta1, I am able to execute a particular page with no problem, that
page opens up in the comes up just fine.

On Win2kdev1, when I go to execute the same page, it opens a file
download dialog and asks me whether I want to open or save the "file".
Other ASP pages in the same directory display correctly. As far as I
can tell, there is nothing obviously different between these working
pages and the ASP page which causes the download dialog to open. The
filetypes are all .ASP.

I have verified that the app mappings (in IIS Manager,
Directory/Configuration/App Mappings) are correctly set to point to
asp.dll. I have removed and reset the app mapping just in case, but
still get the same error. The problem can arise on a different page
by doing something as trivial as changing some text and saving the
page.

I have compared file permissions on the file on both servers and they
are exactly the same. I thought something was wrong with the page on
Win2kDev1, so I copied over the page from Beta1. Same problem. I
have checked the IIS logs, and I do not see any errors in the
ex060120.log (for the last date that I tested this).

Does anyone have any ideas for anything I can look at to try to figure
out this issue? TIA.

-- Neil Rossi
 
D

David Wang [Msft]

For the page that causes the file download dialog, use WFetch to make the
same request and post the raw response.

http://www.microsoft.com/downloads/...bc-376b-4a54-95aa-73c9156706e7&displaylang=en

If it happens on random pages and not specific pages, then I would not look
at Application Mapping (which would be consistent) nor the script in the
page (which would be consistent unless the problem is server-specific).

Also, can you report the Global and Site ISAPI Filters installed on both
machines.

My suspicion right now is that some ISAPI Filter is mistakenly adding
certain response headers to ASP pages such that the browser asks to download
the page instead of displaying it.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
 
N

Neil Rossi

Thanks for your response, David. There are, as far as I can see, no
ISAPI filters defined within INetMgr, either for this specific website
or at the Default website level.

Just for the heck of it, I logged in to the remote server and ran the
app throwing the error using localhost. Now I see that the page
showing the download dialog on a remote client, is actually displaying
a "500 Internal Server Error" when logged in to the IIS server.

Here's the log output from WFetch run on the server Win2kDev1. I am
trying to load the page final.asp, so this error page doesn't seem to
give me much info.
------------------------------
started....
WWWConnect::Connect("localhost","443")\n
source port: 2065\r\n
REQUEST: **************\n
GET /onlineservices/grantapp/final.asp HTTP/1.1\r\n
Host: localhost\r\n
Accept: */*\r\n
\r\n
RESPONSE: **************\n
HTTP/1.1 200 OK\r\n
Server: Microsoft-IIS/5.0\r\n
Date: Fri, 27 Jan 2006 18:30:47 GMT\r\n
Connection: close\r\n
Content-Type: application/octet-stream\r\n
Cache-control: private\r\n
Content-Length: 7860\r\n
\r\n
<%@ language="VBScript" %>\r\n
<%\r\n
Option Explicit\r\n
\r\n
Const lngMaxFormBytes = 200\r\n
\r\n
Dim objASPError, blnErrorWritten, strServername, strServerIP,
strRemoteIP\r\n
Dim strMethod, lngPos, datNow, strQueryString, strURL\r\n
\r\n
If Response.Buffer Then\r\n
Response.Clear\r\n
Response.Status = "500 Internal Server Error"\r\n
Response.ContentType = "text/html"\r\n
Response.Expires = 0\r\n
End If\r\n
\r\n
Set objASPError = Server.GetLastError\r\n
%>\r\n
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\r\n
\r\n
<html dir=ltr>\r\n
\r\n
<head>\r\n
<style>\r\n
a:link\t\t\t{font:8pt/11pt verdana; color:FF0000}\r\n
a:visited\t\t{font:8pt/11pt verdana; color:#4e4e4e}\r\n
</style>\r\n
\r\n
<META NAME="ROBOTS" CONTENT="NOINDEX">\r\n
\r\n
<title>The page cannot be displayed</title>\r\n
\r\n
<META HTTP-EQUIV="Content-Type" Content="text-html;
charset=Windows-1252">\r\n
</head>\r\n
\r\n
<script> \r\n
function Homepage(){\r\n
<!--\r\n
// in real bits, urls get returned to our script like this:\r\n
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm \r\n
\r\n
\t//For testing use DocURL =
"res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"\r\n
\tDocURL=document.URL;\r\n
\t\r\n
\t//this is where the http or https will be, as found by searching for
:// but skipping the res://\r\n
\tprotocolIndex=DocURL.indexOf("://",4);\r\n
\t\r\n
\t//this finds the ending slash for the domain server \r\n
\tserverIndex=DocURL.indexOf("/",protocolIndex + 3);\r\n
\r\n
\t//for the href, we need a valid URL to the domain. We search for the
# symbol to find the begining \r\n
\t//of the true URL, and add 1 to skip it - this is the BeginURL
value. We use serverIndex as the end marker.\r\n
\t//urlresult=DocURL.substring(protocolIndex - 4,serverIndex);\r\n
\tBeginURL=DocURL.indexOf("#",1) + 1;\r\n
\turlresult=DocURL.substring(BeginURL,serverIndex);\r\n
\t\t\r\n
\t//for display, we need to skip after http://, and go to the next
slash\r\n
\tdisplayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);\r\n
\tInsertElementAnchor(urlresult, displayresult);\r\n
}\r\n
\r\n
function HtmlEncode(text)\r\n
{\r\n
return text.replace(/&/g, '&amp').replace(/'/g,
'&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\r\n
}\r\n
\r\n
function TagAttrib(name, value)\r\n
{\r\n
return ' '+name+'="'+HtmlEncode(value)+'"';\r\n
}\r\n
\r\n
function PrintTag(tagName, needCloseTag, attrib, inner){\r\n
document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner)
);\r\n
if (needCloseTag) document.write( '</' + tagName +'>' );\r\n
}\r\n
\r\n
function URI(href)\r\n
{\r\n
IEVer = window.navigator.appVersion;\r\n
IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 );\r\n
\r\n
return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ?\r\n
encodeURI(href) :\r\n
escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';');\r\n
}\r\n
\r\n
function InsertElementAnchor(href, text)\r\n
{\r\n
PrintTag('A', true, TagAttrib('HREF', URI(href)), text);\r\n
}\r\n
\r\n
//-->\r\n
</script>\r\n
\r\n
<body bgcolor="FFFFFF">\r\n
\r\n
<table width="410" cellpadding="3" cellspacing="5">\r\n
\r\n
<tr> \r\n
<td align="left" valign="middle" width="360">\r\n
\t<h1 style="COLOR:000000; FONT: 13pt/15pt verdana"><!--Problem-->The
page cannot be displayed</h1>\r\n
</td>\r\n
</tr>\r\n
\r\n
<tr>\r\n
<td width="400" colspan="2">\r\n
\t<font style="COLOR:000000; FONT: 8pt/11pt verdana">There is a
problem with the page you are trying to reach and it cannot be
displayed.</font></td>\r\n
</tr>\r\n
\r\n
<tr>\r\n
<td width="400" colspan="2">\r\n
\t<font style="COLOR:000000; FONT: 8pt/11pt verdana">\r\n
\r\n
\t<hr color="#C0C0C0" noshade>\r\n
\t\r\n
<p>Please try the following:</p>\r\n
\r\n
\t<ul>\r\n
<li id="instructionsText1">Click the \r\n
<a href="javascript:location.reload()">\r\n
Refresh</a> button, or try again later.<br>\r\n
</li>\r\n
\t \r\n
<li>Open the \r\n
\t \r\n
\t <script>\r\n
\t <!--\r\n
\t if (!((window.navigator.userAgent.indexOf("MSIE") > 0) &&
(window.navigator.appVersion.charAt(0) == "2")))\r\n
\t {\r\n
\t \t Homepage();\r\n
\t }\r\n
\t //-->\r\n
\t </script>\r\n
\r\n
\t home page, and then look for links to the information you want.
</li>\r\n
</ul>\r\n
\t\r\n
<h2 style="font:8pt/11pt verdana; color:000000">HTTP 500.100 -
Internal Server\r\n
Error - ASP error<br>\r\n
Internet Information Services</h2>\r\n
\r\n
\t<hr color="#C0C0C0" noshade>\r\n
\t\r\n
\t<p>Technical Information (for support personnel)</p>\r\n
\r\n
<ul>\r\n
<li>Error Type:<br>\r\n
<%\r\n
Dim bakCodepage\r\n
on error resume next\r\n
\t bakCodepage = Session.Codepage\r\n
\t Session.Codepage = 1252\r\n
on error goto 0\r\n
Response.Write Server.HTMLEncode(objASPError.Category)\r\n
If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(",
" & objASPError.ASPCode)\r\n
Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) &
")" ) & "<br>"\r\n
\r\n
If objASPError.ASPDescription > "" Then \r\n
\t\tResponse.Write Server.HTMLEncode(objASPError.ASPDescription) &
"<br>"\r\n
\r\n
elseIf (objASPError.Description > "") Then \r\n
\t\t Response.Write Server.HTMLEncode(objASPError.Description) &
"<br>" \r\n
end if\r\n
\r\n
\r\n
\r\n
blnErrorWritten = False\r\n
\r\n
' Only show the Source if it is available and the request is from
the same machine as IIS\r\n
If objASPError.Source > "" Then\r\n
strServername = LCase(Request.ServerVariables("SERVER_NAME"))\r\n
strServerIP = Request.ServerVariables("LOCAL_ADDR")\r\n
strRemoteIP = Request.ServerVariables("REMOTE_ADDR")\r\n
If (strServername = "localhost" Or strServerIP = strRemoteIP) And
objASPError.File <> "?" Then\r\n
Response.Write Server.HTMLEncode(objASPError.File)\r\n
If objASPError.Line > 0 Then Response.Write ", line " &
objASPError.Line\r\n
If objASPError.Column > 0 Then Response.Write ", column " &
objASPError.Column\r\n
Response.Write "<br>"\r\n
Response.Write "<font style=""COLOR:000000; FONT: 8pt/11pt
courier new""><b>"\r\n
Response.Write Server.HTMLEncode(objASPError.Source) &
"<br>"\r\n
If objASPError.Column > 0 Then Response.Write
String((objASPError.Column - 1), "-") & "^<br>"\r\n
Response.Write "</b></font>"\r\n
blnErrorWritten = True\r\n
End If\r\n
End If\r\n
\r\n
If Not blnErrorWritten And objASPError.File <> "?" Then\r\n
Response.Write "<b>" & Server.HTMLEncode( objASPError.File)\r\n
If objASPError.Line > 0 Then Response.Write Server.HTMLEncode(",
line " & objASPError.Line)\r\n
If objASPError.Column > 0 Then Response.Write ", column " &
objASPError.Column\r\n
Response.Write "</b><br>"\r\n
End If\r\n
%>\r\n
</li>\r\n
<p>\r\n
<li>Browser Type:<br>\r\n
<%= Server.HTMLEncode(Request.ServerVariables("HTTP_USER_AGENT"))
%>\r\n
</li>\r\n
<p>\r\n
<li>Page:<br>\r\n
<%\r\n
strMethod = Request.ServerVariables("REQUEST_METHOD")\r\n
\r\n
Response.Write strMethod & " "\r\n
\r\n
If strMethod = "POST" Then\r\n
Response.Write Request.TotalBytes & " bytes to "\r\n
End If\r\n
\r\n
Response.Write Request.ServerVariables("SCRIPT_NAME")\r\n
\r\n
lngPos = InStr(Request.QueryString, "|")\r\n
\r\n
If lngPos > 1 Then\r\n
Response.Write "?" & Server.HTMLEncode(Left(Request.QueryString,
(lngPos - 1)))\r\n
End If\r\n
\r\n
Response.Write "</li>"\r\n
\r\n
If strMethod = "POST" Then\r\n
Response.Write "<p><li>POST Data:<br>"\r\n
If Request.TotalBytes > lngMaxFormBytes Then\r\n
Response.Write Server.HTMLEncode(Left(Request.Form,
lngMaxFormBytes)) & " . . ."\r\n
Else\r\n
Response.Write Server.HTMLEncode(Request.Form)\r\n
End If\r\n
Response.Write "</li>"\r\n
End If\r\n
\r\n
%>\r\n
<p>\r\n
<li>Time:<br>\r\n
<%\r\n
datNow = Now()\r\n
\r\n
Response.Write Server.HTMLEncode(FormatDateTime(datNow, 1) & ", " &
FormatDateTime(datNow, 3))\r\n
on error resume next\r\n
\t Session.Codepage = bakCodepage \r\n
on error goto 0\r\n
%>\r\n
</li>\r\n
</p>\r\n
<p>\r\n
<li>More information:<br>\r\n
<% strQueryString = "prd=iis&sbp=&pver=5.0&ID=500;100&cat=" &
Server.URLEncode(objASPError.Category) & _\r\n
"&os=&over=&hrd=&Opt1=" & Server.URLEncode(objASPError.ASPCode) &
"&Opt2=" & Server.URLEncode(objASPError.Number) & _\r\n
"&Opt3=" & Server.URLEncode(objASPError.Description) \r\n
strURL = "http://www.microsoft.com/ContentRedirect.asp?" &
_\r\n
strQueryString\r\n
%>\r\n
<a href="<%= strURL %
">Microsoft Support</a>\r\n
</li>\r\n
</p>\r\n
\r\n
</font></td>\r\n
</tr>\r\n
\r\n
</table>\r\n
</body>\r\n
</html>\r\n
WWWConnect::Close("localhost","443")\n
closed source port: 2065\r\n
finished.

===========================
 
D

David Wang [Msft]

/onlineservices/grantapp/final.asp is being treated as a static file and
downloaded verbatim (<% %> is still there) instead of as a dynamic ASP file
that is executed to generate a HTML response.

Assuming no ISAPI Filter, this means either:
1. .asp does not exist as an Application Mapping for this URL resource
2. Execute permission is "None" for this URL resource

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
 
N

Neil Rossi

Thank you, David. I just checked, and Execute permissions for the
default web site as well as Online Services (the misbehaving site)
virtual directory is set to Scripts Only.

..asp is an application mapping for both the Default Web site as well
as Online Services. I just checked Beta1 and it was configured
exactly the same as on the Win2kDev1 server. I am running out of
things to check. It is as if the application mapping was being
ignored for _specific_ files within the site. Am I correct in
assuming that the mapping is determined only by the file extension
(.asp) and not the content of the file?
 
N

Neil Rossi

Here's the solution. It required a paid support call to MS, but maybe
this will save somebody else some aggravation.

There were actually two problems. First, the custom error defined for
error 500;100 (internal server error; ASP error) in
C:\WINNT\help\iisHelp\common seems to have become corrupted. It was
not being recognized as a valid HTML or ASP page, and so prompted a
download dialog on the client (it displayed the source text if it was
run on Win2kDev1 under localhost).

*That* error was being caused by an out-of-date ASP include file which
was loading a dictionary object of loan types. We never saw that
error because it was being masked by the corrupted custom error page,
which displayed as a text file. The MS support person suggested
working around the bad error page by clicking “Set to default” in
InetMgr when you highlight the 500;100 error page. Once that was
done, the bad include file was immediately apparent and was a simple
fix.

But we still wasted several man-days trying to track it down! All
errors are simple once you figure them out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top