Take the 2-minute tour ×

I apologize for the incredibly simplistic nature of this question but I am having no luck looking elsewhere. What I'm trying to accomplish is to only display a div if ASP.net isn't processing pages correctly; similar to <noscript> for JavaScript. An acceptable alternative would be to create the div and use ASP to hide it.

As I understand it:
- Client hits IIS
- IIS finds the page
- ASP finds anything in the page it has to handle
- the document is served back to client.

I wan this to kick in if IIS cannot perform this processing of ASP code (the module being disallowed, permissions, anything...).
- Client Requests document - IIS runs ASP code and the page says "ASP WORKS!!!" - Or ASP doesn't and it says "ASP is broken"

I know this is vague but I'm looking for something as simple as that. IIS can handle ASP code or it cannot.

Maybe it will help if I explain what I am trying to accomplish on a higher level. I do a good deal of Exchange troubleshooting. I know JavaScript pretty well but I have never touched ASP (hence the total lack of structure in this question). Occasionally the pieces of Exchange that rely on IIS will stop working because of any number of problems in .Net. IIS is working so the site is still available, just some of the cogs aren't turning. My goal is to find a quick way of determining if ASP pages can even 'run'.

Until now, I had a basic HTML file containing a time function written in ASP; so it either works or it doesn't. I would like something a little more professional looking.

share|improve this question
How do you define "not working"? If it doesn't work at all, it won't be able to generate the page in the first place. –  CodesInChaos Jun 13 '11 at 20:38
What do you mean 'ASP.Net is not working'? –  Jay Jun 13 '11 at 20:38
What do you mean if ASP.Net isn't working properly? If ASP.net isn't working properly... your site won't be working.... –  womp Jun 13 '11 at 20:38
By not working I mean that general. Anything that would prevent ASP code from functioning properly. There is minimal code inside an HTML file and I would like the display to be different if ASP isn't "doing what it's supposed to" but the web server (in this case IIS) is up. –  Gary Jun 13 '11 at 20:40
add comment

4 Answers

up vote 1 down vote accepted

This is somewhat of an open question - I understand why you are asking this though.

Let's take each kind of failure and talk about it

Severe Memory Issues - undetermined response. You hope to get an exception - OutOfMemory exception but this depends on where it happened and the severity.

.Net configuration broke - your pages may not return at all

IIS Misconfigured - not allowing script - you will get a 404 anyways

Exception in your program (developers fault) - you can get a YSOD (yellow screen of death - giving error details) - here you can control via a custom error page. You can also install ELMAH to give you a mechanism to log and view these (and get alerted, etc)

Exception in compiling your site or your site configuration (say - in your web.config) - You indeed may not get a YSOD that you have control over. You can setup custom error pages as well in IIS to handle a 500 error.

So - there are various scenarios, but you can only handle 'the best of' - the general scenario is to have your own custom error handler to handle program issues. Other 'severe' issues are tougher to handle and generally shouldn't happen anyways.

share|improve this answer
Thanks a lot Adam! It's pretty hard to ask a question on a subject you know next to nothing about. Maybe I'll start running Exchange through Apache/PHP ;-) –  Gary Jun 13 '11 at 21:02
haha : ) I know how you feel - you wish you had someone right next to you to bounce the questions off and just speed through learning a new technology. thankfully theres stackoverflow –  Adam Tuliper - MSFT Jun 13 '11 at 21:11
add comment

In IIS, you can set the HTTP 500 status code to a custom page (i.e. a .html page). That should cover most ASP.NET errors. You won't be able to do much else aside from serve another page though.

share|improve this answer
Sounds like what the OP wants. One important point here is to display the error page without redirect and using the correct http status code. Many sites get one of these wrong. –  CodesInChaos Jun 13 '11 at 20:42
Ugh I know!! It always bothers me inside when I see that happen in Firebug :x –  wsanville Jun 13 '11 at 20:48
add comment

Even though I don't understand the 'not working' part of your question, here's my take on a possible solution.

Use an *.html page to make sure it gets delivered even if asp.net for some reason isn't working (thus can't process an *.aspx page)

From within the html page send an ajax request to an aspx-resource which should return an error if it can't be processed.

If the ajax call succeeds, asp.net seems to be working.

Hope this helps

share|improve this answer
Thanks Dennis, "cannot process *.asp(x) pages" is a better way of wording it. –  Gary Jun 13 '11 at 20:52
add comment

javascript is client biased code meaning it can be processed by browsers that do not support or have script turned off. ASP is server side platform and should not be deployed to servers that do not support it and if it was would most often not be servable by the web server. So there for there is no corresponding idiom to

share|improve this answer
Understood, I realize ASP is a server-side script and that is exactly what I'm trying to display: Server-side issues. –  Gary Jun 13 '11 at 20:47
add comment

Your Answer


