2017-02-16 4 views
0

나는 Azure - example.azurewebsites.net에 웹 사이트를 가지고 있습니다. 기본 페이지를 index.html로 구성했습니다. 이제 웹 사이트는 index.html과 login.html을 제외한 인증되지 않은 웹 사이트 사용자를 거부한다고 가정합니다. 내 코드의양식 인증의 사용자가 하늘색 웹 사이트에서 작동하지 않을 수 있음

:

<system.webServer> 
    <defaultDocument> 
     <files> 
     <clear/> 
     <add value="index.html" /> 
     </files> 
    </defaultDocument> 
    </system.webServer> 
    <location path="index.html"> 
     <system.web> 
     <authorization> 
      <allow users="*"/> 
     </authorization> 
     </system.web> 
    </location> 
    <system.web> 
    <authentication mode="Forms"> 
     <forms loginUrl="login.html" defaultUrl="~/" /> 
    </authentication> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 
    </system.web> 

example.azurewebsites.net/index.html -이 작동합니다. example.azurewebsites.net -이 작업은 login.html로 리디렉션되지 않습니다. 그러나 그들은 같은 것으로되어 있습니다. 인증없이 example.azurewebsites.net은 index.html로 리디렉션됩니다.

어디서 잘못 되었나요?

답변

0

기본 페이지를 index.html로 구성했습니다. 이제 웹 사이트는 index.html과 login.html을 제외하고 웹 사이트에 대한 인증되지 않은 사용자를 거부한다고 가정합니다.

양식 인증을 사용하여 응용 프로그램의 웹 페이지에 대한 사용자 액세스를 제한하려면 다음 Web.config를 참조하십시오.

<location path="index.html"> 
    <system.web> 
    <authorization> 
     <allow users="*"/> 
    </authorization> 
    </system.web> 
</location> 

<system.web> 
    <compilation debug="true" targetFramework="4.5"> 
    <buildProviders> 
     <add extension=".html" type="System.Web.Compilation.PageBuildProvider" /> 
    </buildProviders> 
    </compilation> 
    <httpRuntime targetFramework="4.5"/> 

    <authentication mode="Forms"> 
    <forms loginUrl="login.html" name=".ASPXFORMSAUTH"> 
    </forms> 
    </authentication> 
    <authorization> 
    <deny users="?" /> 
    </authorization> 
</system.web> 

<system.webServer> 
    <handlers> 
    <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" /> 
    </handlers> 
</system.webServer> 

example.azurewebsites.net/index.html -이 작동합니다. example.azurewebsites.net -이 작업은 login.html로 리디렉션되지 않습니다. 그러나 그들은 같은 것으로되어 있습니다.

default document으로 index.html을 지정했는지 확인하십시오.

편집 :

example.azurewebsites.net은 - 이것은 (login.html 리디렉션)하지 않습니다.

example.azurewebsites.net에서 example.azurewebsites.net/index.html로 사용자를 리디렉션하는 URL 다시 쓰기 규칙을 만들 수 있습니다.

<rewrite> 
    <rules> 
    <rule name="redirecttoindexpage" stopProcessing="true"> 
     <match url="^$" /> 
     <action type="Redirect" url="/index.html" redirectType="Permanent"/> 
    </rule> 
    </rules> 
</rewrite> 
+0

감사합니다. index.html이 실제로 기본 문서로 지정됩니다. 사실, 폼 인증을 제거하면 example.azurewebsites.net이 index.html로 리디렉션됩니다. 문제는 양식 인증에만 있습니다. – Dazhush

0

확인할 사항은 web.config에 다음 항목이 있는지 확인하는 것입니다. \ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319을 구성 \ web.config를 \ 로컬 OS에 : 모듈이 C에 정의되어

<system.webServer> 
<modules runAllManagedModulesForAllRequests="true"> 
    <remove name="FormsAuthenticationModule" /> 
    <add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" /> 
</modules> 

당신은 일반적으로이 작업을 수행 할 필요가 없습니다. 그러나 Azure 웹 서비스 환경에서는 그렇지 않습니다.