How to specify root (/) location in web.config?

前端 未结 10 1071
说谎
说谎 2020-12-08 06:22

How does one specify root location in web.config to allow unauthenticated users access it?

The root location is served by default.aspx, but users normally don\'t see

相关标签:
10条回答
  • 2020-12-08 06:48

    Use this :

    <location path="Default.aspx">
      <system.web>
        <authorization>
          <allow users="*"/>
        </authorization>
      </system.web>
    </location>
    <location path="~">
      <system.web>
        <authorization>
          <allow users="*"/>
        </authorization>
      </system.web>
    </location>
    

    It works for me.

    0 讨论(0)
  • 2020-12-08 06:55

    The way we done it in the past was to create a folder for all functionality that requires login and set require auth for that folder. All aspx go to that folder. The root of the site stays open.

    0 讨论(0)
  • 2020-12-08 07:00

    If you want to specify the root of the directory, use <location path="" >

    0 讨论(0)
  • 2020-12-08 07:02

    You can achieve by 2 method

    Method 1:

    You can set redirect path to http://mysite.com/default.aspx in IIS if any user directly comes to your site.in IIS7 you can do that by clicking on Default Document. Here i attached image for your reference

    IIS7 setting to add your default page redirection

    Method 2

    You can go through this URL ASp.NET Membership to set your web config settings.

    Let me know if you need more detail on this.

    0 讨论(0)
提交回复
热议问题