Export to excel in classic asp stopped working [duplicate] - excel

IIS 7.5 , 2008rc2, classic asp, 500 error msg:
The page cannot be displayed because an internal server error has occurred.
I need to know how to configure IIS to get a more detailed error.
I've tried setting to true all of debugging options in the ASP configuration.
But that didn't work. Can anyone help me?

I have come to the same problem and fixed the same way as Alex K.
So if "Send Errors To Browser" is not working set also this:
Error Pages -> 500 -> Edit Feature Settings -> "Detailed Errors"
Also note that if the content of the error page sent back is quite short and you're using IE, IE will happily ignore the useful content sent back by the server and show you its own generic error page instead. You can turn this off in IE's options, or use a different browser.

If you're on a remote server you can configure your web.config file like so:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>

Double click "ASP" in the site's Home screen in IIS admin, expand "Debugging Properties", enable "Send errors to browser", and click "Apply".
Under "Error Pages" on the home screen select "500", then "Edit feature settings" and select "Detailed Errors".
Note that the same steps apply for IIS 8.0 (Windows Server 2012).

After trying Vaclav's and Alex's answer, I still had to disable "Show friendly HTTP error messages" in IE

TLDR:First determine where in the pipeline you're getting the error from (scroll looking for screenshots of something that resembles your error), make changes to get something new, repeat.
First determine what error message you are actually seeing.
If you are seeing the file located here...
%SystemDrive%\inetpub\custerr<LANGUAGE-TAG>\500.htm
...which generally looks like this:
**...then you know you are seeing the currently configured error page in IIS ** and you do NOT need to change the ASP.net customErrors setting, asp error detail setting, or "show friendly http errors" browser setting.
You may want to look at the above referenced path instead of trusting my screenshot just in case somebody changed it.
"Yes, I see the above described error..."
In this case, you are seeing the setting of <httpErrors> or in IIS Manager it's Error Pages --> Edit Feature Settings. The default for this is errorMode=DetailedLocalOnly at the server node level (as opposed to the site level) which means that while you will see this configured error page while remote, you should be able to log on locally to the server and see the full error which should look something like this:
You should have everything that you need at that point to fix the current error.
"But I don't see the detailed error even browsing on the server"
That leaves a couple of possibilities.
The browser you are using on the server is configured to use a proxy
in its connection settings so it is not being seen as "local".
You're not actually browsing to the site you think you are browsing to - this commonly happens when there's a load balancer involved. Do a ping check to see if dns gives you an IP on the server or somewhere else.
Your site's httpErrors settings is set for "Custom" only. Change it to "DetailedLocalOnly". However, if you have a configuration error, this may not work since the site level httpErrors is also a configuration item. In that case proceed to #4
The default for httpErrors for all sites is set for "Custom". In this case you need to click on the top level server node in IIS Manager (and not a particular site) and change the httpErrors settings there to DetailedLocalOnly. If this is an internal server and you're not worried about divulging sensitive information, you could also set it to "Detailed" which will allow you to see the error from clients other than the server.
You're missing a module on the server like UrlRewrite (this one bites me a lot, and it often gives the generic message regardless of the httpErrors settings).
"Logging on to the server is not an option for me"
Change your site's httpErrors to "Detailed" so you can see it remotely. But if it doesn't work your error might already be a config error, see #3 immediately above. So you might be stuck with #4 or #5 and you're going to need somebody from your server team.
"I'm not seeing the error page described above. I'm seeing something different"
If you see this...
...and you expect to see something like this...
...then you need to change "Send errors to browser" to true in IIS Manager, under Site --> IIS --> ASP --> Debugging Properties
If you see this...
or this...
...you need to disable friendly errors in your browser or use fiddler's webview to look at the actual response vs what your browser chooses to show you.
If you see this...
...then custom errors is working but you don't have a custom error page (of course at this point were talking about .net and not classic asp). You need to change your customErrors tag in your web.config to RemoteOnly to view on the server, or Off to view remotely.
If you see something that is styled like your site, then custom errors is likely On or RemoteOnly and it's displaying the custom page (Views->Shared->Error.cshtml in MVC for example). That said, it is unlikely but possible that somebody changed the pages in IIS for httpErrors so see the first section on that.

In web.config under
<system.webServer>
replace (or add) the line
<httpErrors errorMode="Detailed"></httpErrors>
with
<httpErrors existingResponse="PassThrough" errorMode="Detailed"></httpErrors>
This is because by default IIS7 intercepts HTTP status codes such as 4xx and 5xx generated by applications further up the pipeline.
Next, enable "Send Errors to Browser" under the "ASP" section, and under "Error Pages / Edit Feature Settings", select "Detailed errors".
Also, give Write permissions on the website folder to the IIS_IUSRS builtin group.

try setting the value of the "existingResponse" httpErrors attribute to "PassThrough". Mine was set at "Replace" which was causing the YSOD not to display.
<httpErrors errorMode="Detailed" existingResponse="PassThrough">

One thing nobody's mentioned is as a very quick and temporary fix, you can view the error on the localhost of that web server.

You may also verify that if you changed your main website folder (c:\inetpub\wwwroot) to another folder you must give read permission to the IIS_IUSRS group in the new folder.

Fot people who have tried EVERYTHING and just CANNOT get the error details to show, like me, it's a good idea to check the different levels of configuration. I have a config file on Website level and on Application level (inside the website) check both. Also, as it turned out, I had Detailed Errors disabled on the highest node in IIS (just underneath Start Page, it has the name that is the same as the webservers computername). Check the Error Pages there.

Found it.
http://blogs.iis.net/ksingla/archive/2009/02/16/iis-7-5-updates-to-custom-errors-and-compression.aspx
run cmd as administrator, go to your system32\inetsrv folder and execute:
appcmd.exe set config -section:system.webServer/httpErrors -allowAbsolutePathsWhenDelegated:true
Now I can see detailed asp errors .

If you run the browser in the server and test your url of the project with the local ip you have received all errors of that project without a generally error page(for example 500 error page).

In my case it was permission issue.
Open application folder properties -> Security tab -> Edit -> Add
IIS AppPool\[DefaultAppPool or any other apppool] (if use ApplicationPoolIdentity option)
IUSRS
IIS_IUSRS

Double check the encoding of the asp file you are testing.
For instance if you created a file like below on a Windows Server Core 2019 :
echo "<%# LANGUAGE=Javascript %>" > test.asp
echo "<%Response.Write("test");%>" >> test.asp
Then test.asp will be encoded in Unicode, and requesting it will produce a 500 without any details.
Do a notepad test.asp, then click on "Save As..." and choose "ANSI" encoding to fix it.

Related

Fix razor WebPages with friendly URL returning 404 error

I have a website written as razor ASP.Net code wit the extension .cshtml. I wrote the site using WebMatrix and the site runs fine when i run it on web martix's "LocalHost". The links and all my code work, but as soon as I try to run the website from my IIS server the page links no longer work properly. When I click on a link it returns the 404 error page. If I type in the .cshtml extension the page loads correctly and all is right with the world except the file extension. The only page that still works is the index page because it is a default page.
Every place I've checked says that it should run without the extension as a default of asp.net or if it doesn't run as default then use the url re-write plugin.
The Default isn't running and I am unable to use the URL rewrite tool.
What can I do to get the default to work or is there another way to have the extensions not display without using URL re-write
ps. I know that if I put the files in a folder with the link name and rename them to index.cshtml This will work but I feel it is a very backhanded way of doing it so I would prefer not to do it that way.
pps. before any one suggests a solution for mvc I am explicitly NOT USING MVC Logic. thank you.
Try two things:
Set the application pool to ASP.NET 4.0. Then restart I IIS.
Add the following key to <system.webServer> section of Web.Config:
<modules runAllManagedModulesForAllRequests="true" />

ColdFusion 10 Update 11 404 handler not firing

I know CF 10 has a number of issues surrounding 404 handling. This seems to be different from the other reports. Details:
Win2k8 R2/64 and IIS7.5
Upgrading from identical config on separate server. Only difference is CF9 -> CF 10. All works fine on CF9. Adobe CF9 Lockdown implemented on original server, CF10 Lockdown implemented on this server.
missing template handler set in CF Admin as /404.cfm, which should translate to the Cfusion root (c:\ColdFusion10\cfusion\wwwroot).
IIS has been config'd to trace failed 404 requests
IIS 404 handling is default (originally executed a CF URL but removed to simplify debug).
Coldfusion webroot where missing template handler resides is default install location
IIS site root is entirely different: c:\Other\Place\SiteRoot\
A sitewide error handler is also set in CF Admin in the same ColdFusion webroot and works as expected.
404.cfm is very simple:
<cfheader
statuscode="404"
statustext="Not Found">
<h1>404</h1><p>Page not found</p>
<cfoutput>#now()#</cfoutput>
Inputting the bad url [domain]/foo.cfm should display the above template. Instead I get an IIS error screen. The CF missing template handler is ignored. The IIS failed request trace says the url is
http://[mydomain]:80/jakarta/isapi_redirect.dll
and a detail view shows at Step 1
RequestURL="http://[mydomain]:80/foo.cfm
I've seen plenty of issues surrounding CF10 and 404's, but never that the missing template handler assignment is completely ignored. In CF9 this will generate output as expected. Anyone seen anything like this?
EDIT:
I have also tried config'ing this to match a different CF9 server I have running: Added a CF mapping to the web root of the site. Then placed the missing template handler in the web site's root rather than the CF default web root, lastly in cfadmin pointed to the missing template handler in the web site's root using the mapped folder. Same problem. Works fine in CF9 and not at all using CF10.
EDIT2:
As Miguel F pointed out in the comments, you can shut off HTML error codes in CF Admin and this will let the Missing Template Handler fire... BUT you get a 200 header to go with it. Apparently cfheader statements are ignored as I have tried placing the cfheader at the beginning and end of the template... still yields a 200. Visually fine but insofar as SEO is concerned thats a disaster. Just looked and my CF9 servers do not require this setting to be unchecked for their handlers to work.
EDIT3
Dana Kowalski's solution displays detailed IIS errors to the public, so for a 404 on, say, a made-up extension (foo.xyz), the screen will show file paths. Default behavior is to NOT display detailed errors except when running templates locally, and display custom error pages to visitors. The CF error template should work fine with that setting.
POSSIBLE SOLUTION
I stepped back to ColdFusion 9 as part of debugging this problem, and may have discovered the solution while debugging a separate related issue.
In the IIS Manager, click on the site in question. Select the Error Pages option. Select the 'Edit Feature Settings' link on the right side. Check that the 'Detailed Errors' option is selected.
If you have either of the other two selected, there are times IIS 7.x will take over and not let ColdFusion handle it.

How to display an error page for static files when using existingResponse="PassThrough" in IIS 7

To be able to get my application (Umbraco CMS) to handle 404 errors, I need to have following setting in my web.config:
<httpErrors existingResponse="PassThrough" />
It works well for displaying a custom 404 error page from Umbraco, but it doesn't work for displaying a 404 error page when a static file cant be found.
For example http://www.example.com/non-existing-file.png returns a 404 status code, but respons is blank. That fits with this description of the PassThrough mode:
PassThrough – If existingResponse is seen as “PassThrough”, custom
error module will always pass through responses from modules. This
setting will make custom error module return blank response if modules
don’t set any text.
(http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx)
What is the "custom error module"? And how do I get it to return a non blank response?
Update
After stepping through the request handling routines in Umbraco (with a debugger), I have a better understanding of the problem space. As written in the citation above, when existingResponse="PassThrough" then all handling of http errors is done in the custom modules. So to answer my own question, a "custom error module" is in this instance the "UmbracoModule".
One way to solve this problem would be to create a new custom module that will check for the existence of the static files on the disk. It can be done quite nice, I read the list of static files from IIS and read the configuration of customErrors or httpErrors elements from the web.config to get a custom error page. But I kind of think this is crude solution. I would much rather pass the responsibility back to IIS.
Any ideas?
You're correct. For the benefit of anyone else looking for help with this, here's some extra information on 404 handling.
Old Umbraco wiki page - describes your solution using the file /config/umbracoSettings.config
404 for files - works for Umbraco 7 and describes the use of the tag <httpErrors/>
IIS version 6 fix - fixing on IIS6 and how it compares with IIS7

where can i find the default 404 error page for windows sharepoint service 2.0

Where can i find the default htm file, mapped to show the 404 error in Sharepoint service 2.0. Currently whenever the request for a site hits the 404 error, it goes to the default page, but the point to note here is, which is not the one we set in IIS custom error option.
My requirement here is to make few modification in the 404 error page. I tried mapping the request to a custom error page with <customErros> tag in web.config. But unfortunately, its still showing the default 404 error page. When i checked the viewsource of the error page i can see some comments like, res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm
Any idea about this? Thanks in advance
I haven't had to do this but this entry looks quite reasonable: http://blogs.msdn.com/b/jingmeili/archive/2007/04/08/how-to-create-your-own-custom-404-error-page-and-handle-redirect-in-sharepoint-2007-moss.aspx
Basically when you install WSS it hi-jacks IIS. You can still do most of the things you would expect but you need to go through the Central Administration pages and the XML files that control many aspects of SharePoint.

Sharepoint error details(call stack information) is not displayed in the sharepoint site

How to enable the error information in the Sharepoint site by modifying the web.config file.?. I have done the following changes in web.config file
Callstack = true
CustomErrors mode = Off
Compilation debug = true
But still i am not able to get the call stack details(error details) in the sharepoint site for a error, instead of that i am getting this following error
"To enable the details of this specific error message to be viewable on the local server machine, please create a tag within a "web.config" file located in the root directory of the current web application". Please correct me on this?.
custom errors mode off, (or on, I can never remember). Then set debug=true. The catch is that there are many different web.configs used by sharepoint. There's one on the web application level (in inetpub, virtual directories), then there's one for layouts pages, control templates, etc in /web server extensions/14/. You have to make these changes in all of the relevant web configs associated with your code.
And obviously, make sure this is always turned off in production for security reasons.
You do not need to do an iisreset, changing a web.config file will cause one automatically.
Did you run iisreset?
Make sure you're changes in the web.config look like these:
<customErrors mode=”Off” />
<SafeMode … CallStack=”true” … >
<trace enabled=”true” pageOutput=”true”/>
PS: Showing stack traces in a production environment is not recomenned, instead use a tool like ULSViewer for diving through the log files.

Resources