HTTP 404 Page Not Found in Web Api hosted in IIS 7.5

I was struggling with this as well. Fortunately, Steve Michelotti documented a solution that worked for me here. At the end of the day, I enabled all verbs (verb=”*”) to the ExtensionlessUrlHandler-Integrated-4.0 handler in my web config. <system.webServer> <validation validateIntegratedModeConfiguration=”false” /> <modules runAllManagedModulesForAllRequests=”true” /> <handlers> <remove name=”ExtensionlessUrlHandler-Integrated-4.0″ /> <add name=”ExtensionlessUrlHandler-Integrated-4.0″ path=”*.” verb=”*” type=”System.Web.Handlers.TransferRequestHandler” resourceType=”Unspecified” requireAccess=”Script” … Read more

Unable to authenticate to ASP.NET Web Api service with HttpClient

I have investigated the source code of HttpClientHandler (the latest version I was able to get my hands on) and this is what can be found in SendAsync method: // BeginGetResponse/BeginGetRequestStream have a lot of setup work to do before becoming async // (proxy, dns, connection pooling, etc). Run these on a separate thread. // … Read more

How do I protect static files with ASP.NET form authentication on IIS 7.5?

If you application pool is running in Integrated mode then you can do the following. Add the following to your top level web.config. <system.webServer> <modules> <add name=”FormsAuthenticationModule” type=”System.Web.Security.FormsAuthenticationModule” /> <remove name=”UrlAuthorization” /> <add name=”UrlAuthorization” type=”System.Web.Security.UrlAuthorizationModule” /> <remove name=”DefaultAuthentication” /> <add name=”DefaultAuthentication” type=”System.Web.Security.DefaultAuthenticationModule” /> </modules> </system.webServer> Now you can use the standard ASP.NET permissions in your … Read more

401 response for CORS request in IIS with Windows Auth enabled

You can allow only OPTIONS verb for anonymous users. <system.web> <authentication mode=”Windows” /> <authorization> <allow verbs=”OPTIONS” users=”*”/> <deny users=”?” /> </authorization> </system.web> According W3C specifications, browser excludes user credentials from CORS preflight: https://dvcs.w3.org/hg/cors/raw-file/tip/Overview.html#preflight-request

How to give ASP.NET access to a private key in a certificate in the certificate store?

Create / Purchase certificate. Make sure it has a private key. Import the certificate into the “Local Computer” account. Best to use Certificates MMC. Make sure to check “Allow private key to be exported” Based upon which, IIS 7.5 Application Pool’s identity use one of the following. IIS 7.5 Website is running under ApplicationPoolIdentity. Open … Read more