0

I can't figure out the correct syntax in my web.config to allow the general public to see the index.aspx as a default page and for any other page to go thru the login page.

If I use www.mywebsite.com/index.aspx the page is displayed fine and I don't have to go thru the login process. But if I try www.mywebsite.com I am being redirected to the login.aspx page. Is there a way to display index.aspx if no specific page is given?

 <!-- Allow the login page -->
 <location path="Login.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
 <!-- Allow the index.aspx page -->
  <location path="Index.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
<!-- deny the root folder -->
  <location path="">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>

 ....

 <authentication mode="Forms">
      <forms name="GI" loginUrl="/Login.aspx" defaultUrl="/default.aspx" protection="All" timeout="180" />
    </authentication>

Corobori
  • 123
  • 6

1 Answers1

0

I found a solution based upon that comment made a while ago. By adding a rewrite rule it did the trick, as 10 years have passed, since the post where I found the answer was written, perhaps now a smarter way exists.

<rewrite>
<rules>
<rule name="Rewrite to Index.aspx">
  <match url="^$" />
  <action type="Rewrite" url="Index.aspx" />
</rule>
</rules>
Corobori
  • 123
  • 6