Question

Hi guys, ive got a stupid problem.

My Custom handler is working 100% on Asp.NET Development server but when i publish the site to IIS 5.1 whenever i try to run Comment/Find (which finds a user via an AJAX call) (i know the naming of my handler sux!!! :)

I get this error:

The page cannot be displayed The page you are looking for cannot be displayed because the page address is incorrect.

Please try the following:

* If you typed the page address in the Address bar, check that it is entered correctly.
* Open the home page and then look for links to the information you want.

HTTP 405 - Resource not allowed Internet Information Services

Technical Information (for support personnel)

* More information:
  Microsoft Support

My code for the AJAX call is:

 function findUser(skip, take) {

        http.open("post", 'Comment/FindUser', true);
        //make a connection to the server ... specifying that you intend to make a GET request
        //to the server. Specifiy the page name and the URL parameters to send
        http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        http.setRequestHeader('Criteria', document.getElementById('SearchCriteria').value);
        http.setRequestHeader("Skip", skip);
        http.setRequestHeader("Take", take);
        http.setRequestHeader("Connection", "close");

        //display loading gif
        document.getElementById('ctl00_ContentPlaceHolder1_DivUsers').innerHTML = 'Loading, Please Wait...<br /><img src="Images/loading.gif" /><br /><br />';

        //assign a handler for the response
        http.onreadystatechange = function() { findUserAction(); };

        //actually send the request to the server
        http.send(null);

}

Please can anyone help me??

Was it helpful?

Solution

Make sure you have allowed the extension on the IIS server. The development server does this automatially for you.

If you open up the properties of the web site then go to the Home Directory Tab and click the configuration button.

In there try adding the extension you are using for the handler pointing. Set the executable to the aspnet_isapi.dll (look at the standard .aspx extension to find where it is on your computer) and uncheck "Check that file exists".

I have been burned by this a couple of time and this sorted the problem

Colin G

OTHER TIPS

On IIS not all calls will be processed by the asp.net handler (unlike cassini the development server) unless the call ends in .aspx, .ashx etc. the .NET isapi dll will not process the call.

The clue is in the

HTTP 405 - Resource not allowed Internet Information Services

You will need to also map the handler in the web.config if there is not a corresponding .ashx file in the file system.

The problem was that when i was calling the handler on the dev. server i was calling it liek this

http.open("post", 'Comment/Rate', true);

because in my web.config i instructed it to catch all "Comment/" Urls and call the CommentHandler.ashx to handler it.

 <add verb="*" path="Comment/*" type="CoffeeMashup2.CommentHandler"/>

However for some reason in IIS it didnt work so i changed the above call to

http.open("post", 'CommentHandler.ashx/Rate', true);

and its worked 100%

thanks a lot guys for your help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top