Score:0

How to show a default page on a protected website running on IIS

mw flag

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>

Score:0
mw flag

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>
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.