简体   繁体   English

重定向到Home.aspx页

[英]Redirect to Home.aspx page

I am trying to redirect to Home.aspx when project load first time, but whatever I did or change in web.config file still redirect to Login.aspx ! 我试图在首次加载项目时重定向到Home.aspx ,但是无论我做过什么还是在web.config文件中进行更改,仍然会重定向到Login.aspx

web.config web.config

<system.webServer>
<defaultDocument>
  <files>
    <clear/>
    <add value="Home.aspx" />
  </files>
</defaultDocument>
</system.webServer>

<location path="Login.aspx">
<system.web>
  <authorization>
    <allow users="?" />
  </authorization>
</system.web>
</location>

<location path="Home.aspx">
<system.web>
  <authorization>
    <allow users="?" />
  </authorization>
</system.web>
</location>

<system.webServer>
<handlers>
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

See path="*." 请参阅path="*." if I make it like path="Home.aspx" it will redirect to Home.aspx but database in entire project will be hidden. 如果我将其设置为path="Home.aspx" ,它将重定向到Home.aspx,但整个项目中的数据库将被隐藏。 The question is what does make the website always redirect to Login.aspx and what is the best way to force website to redirect to Home.aspx when start as first time? 问题是什么使网站始终重定向到Login.aspx ?什么是在首次启动时强制网站重定向到Home.aspx的最佳方法?

Thanks 谢谢

Try Form Authentication In Web.config write 尝试在Web.config中进行表单身份验证

</configuration>
   <system.web>
        <!--Session state Time Out-->
        <sessionState timeout="60" /> 
        <!--My authontication module-->
        <authentication mode="Forms">
          <forms name="WSMSCRM.ASPXAUTH" loginUrl="~/Login/Login.aspx" protection="All" path="/" timeout="60"/>
        </authentication>
        <authorization>
          <deny users="?" />
        </authorization>
        <!--location add-->
        <!--End of Authontication-->
    </system.web>

<!--Rest is ommited-->
  <location path="~/Login/Login.aspx">
    <system.web>

      <authorization>
        <allow users="*"/>

      </authorization>
    </system.web>

  </location>
</configuration>

Brother try this in webconfig file....mine was resolved with this... 兄弟尝试在webconfig文件中执行此操作。...我的问题得到了解决...

<configuration>
<system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="Home.aspx"/>
</system.web>
</configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM