开发者

Why are OPTIONS requests not arriving in my ASP.NET application?

开发者 https://www.devze.com 2023-03-19 06:53 出处:网络
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

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.w开发者_开发百科ebServer><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?


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消