0
votes

I am using OKTA as an Idp for SSO feature. I have added a application in OKTA & have defined below settings :

Single sign on URL & Audience URI (SP Entity ID) : http://localhost/KentorBeginner/ (Even tried by removing trailing slash)

On browsing OKTA SSO Url (different than above), okta redirects to my IIS configured application (KentorBeginner) but I am getting a HTTP Error 405.0 - Method Not Allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

Please find the below screenshots for reference.Direct-browse

Thanking you.

Regards, Ravi Karavadia

2

2 Answers

0
votes

Actually, the problem lied in posting the request to html file.

IIS sees html files as static and only allows them to use GET and HEAD verbs, so when a form was posted I was getting "405 Method Not Allowed...cannot be displayed because an invalid method (HTTP verb) is being used" error.

We need to configure whatever language you're using to handle the html files instead of the static file handler.

So I added below entry for handling html file with a different handler.

under handlers tag of System.WebServer.

Below is my web.config snippet.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="WebDAVModule" />
    </modules>
    <handlers>
      <remove name="ISAPI-dll" />
      <remove name="StaticFile" />
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Script" />
      <add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Either" requireAccess="Execute" allowPathInfo="true" preCondition="bitness32" />
      <add name="html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="None" />
</handlers>
<defaultDocument enabled="true">
      <files>
        <clear />
        <add value="Hello.html" />
      </files>
    </defaultDocument>
    <security>
      <requestFiltering>
        <verbs>
          <add verb="POST" allowed="true" />
        </verbs>
        <fileExtensions>
          <add fileExtension=".html" allowed="true" />
        </fileExtensions>
      </requestFiltering>
    </security>
</system.webServer>

Thanking you.

Regards, Ravi Karavadia

0
votes

I was getting this error on Firefox because I was using Facebook Container extension. After disabling Facebook Container in about:addons I can log in normally - without getting "Method Not Allowed" error