I can’t seem to receive HTTP OPTIONS requests in my IIS6 hosted ASP.NET application. I’m testing it using a debug breakpoint (and file-log) in my Global.asax‘s Application_BeginRequest method. The breakpoint is never hit and the client gets a HTTP 403 Forbidden, I’m assuming from IIS6 directly (GETs and POSTs work fine btw).
I’ve tried several things in the web.config, including adding the following line to either and both the <system.webServer><handlers> and <system.web><httpHandlers> sections.
<add name="OptionsHandler" verb="OPTIONS" path="*" type="System.Web.DefaultHttpHandler"/>
I’ve also played with the <system.webServer><security><requestFiltering><verbs> settings and allowUnlisted="true" and <add verb="OPTIONS" allowed="true"/>.
Also, I’m not using URLScan or any other tools that might intercept the calls. In case you’re interested in IISLogs:
2011-07-11 20:26:05 W3SVC1215124377 127.0.0.1 OPTIONS /test.aspx - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+5.2;+rv:5.0)+Gecko/20100101+Firefox/5.0 403 1 0
Is there a way to receive OPTIONS request in an ASP.NET Application?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
For IIS6, you will have to enable the OPTIONS verb explicitly in the management console, and you will also need to map it to be handlded by ASP .NET. Only then, you will be able to register your handler in <system.web> and get the request processed by ASP .NET.
(Note, <system.webServer> settings only applies to IIS7).
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0