Solved

Getting Ajax call to work in IIS7 web site

Posted on 2008-09-30
1
2,304 Views
Last Modified: 2012-05-05
I am trying to get a web site (.NET 2.0)  I inherited to run in IIS7.  I am stuck trying to get an Ajax call to work.  It is supposed to do an UPDATE  in the database but it doesnt.  It runs fine in IIS6.  In IIS7 it doesnt throw an error to the screen, it just doesnt update the database.  I believe that my problem is that I dont have a Handler set up properly to handle the Ajax call.
                              
The call is made from a web page code behind file like this (vb.net)   (of course a javascript calls this.)
      <Ajax.AjaxMethod()> Function MyDbUpdate(blah, blah, blah, this works fine on existing site)
            blah, blah, works fine
            Return "Good"
      End Function
                              
I have created a few handlers and turned off/on the Inherited handlers, but I am really shootin in the dark.   The two Inherited handlers  handle .ashx files and have
      1. a type of System.Web.UI.SimpleHandlerFactory and
      2. an Executable of %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
                                    
When I create a "Managed Handler" using the gui there is nothing that appears more Ajax related than the above items in the Type drop down.  Maybe I need to install something on the server in order to get the right "Type" to appear in that drop down(?)
                              
One of the handlers that I created, was a "Script Map" and it wrote a <system.webServer> node with children nodes in my web site web.config,  but the Ajax call still didnt work.  In that handler I tried to make it use the Ajax dll (Ajax.dll) that is in the web site directory structure, so the node in the web config looked like this.
      <system.webServer>    
           <handlers>                        
                <add name="AJAX.NET" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="D:\PriorityPost\bin\Ajax.dll" resourceType="Unspecified" />      
           </handlers>                                
      </system.webServer>
                                    
How can I get the Ajax call to work?  Thanks.
0
Comment
Question by:pdschuller
1 Comment
 

Accepted Solution

by:
pdschuller earned 0 total points
ID: 22624520
SOLUTION:  I had to create a Handler in IIS7 that was configured properly.  Based on my inputs, the IIS7 Create Handler wizard wrote an entry to the <Handlers> node of the web site web.config file that looked like this:
<add name="MrAjax" path="Ajax/*.ashx" verb="POST,GET" type="Ajax.PageHandlerFactory, Ajax" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
You can make the name value anything you want.  I got the rest of the values from the similar node in the web.config of the site that was running in IIS6.  IMPORTANT:  in the IIS7 Create Handler wizard there is a dropdown for the type values.  The value that I wanted was not in the drop down, but it let me type anything I wanted in there so I banged in the value from the IIS web.config and it worked.

Can anyone tell me why I got no responses to this question?  If it was the way I wrote it - too much detail/ not enough - I'd like to know so that I dont make the same mistake again.  Or maybe its just that  IIS7 is as poorly documented as it seems to me it is ... or isn't.  Happy coding.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 41
Adding checkmark icon to product added in cart using PHP/Jquery 4 85
IIS Authorization for Web Service 2 46
IIs Windows 2008 HTTPS no access 4 35
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question