Setting folder default page in aspnet

10,600

Solution 1

There is a default document section for web.config, and you can even put a web.config in each folder, and inside that config just have the default document set.

Solution 2

There's a Default Document icon in the IIS section of your websites configuration panel. Open that up and you can add login.aspx to the list.

Share:
10,600
Gonzalo
Author by

Gonzalo

Updated on July 20, 2022

Comments

  • Gonzalo
    Gonzalo almost 2 years

    My question is really simple. I have a Web application with multiple sub-folders and there's no Default.aspx page in any of these.

    How do I set the default page in each of these folders so users can type /folder instead of /folder/login.aspx?

    Can this be done through the web.config file? Should I just rename the file in each folder to Default.aspx?

    Thanks!

  • Gonzalo
    Gonzalo almost 13 years
    Thanks for the quick response antisanity. I checked this page: iis.net/ConfigReference/system.webServer/defaultDocument. However, the problem I have is there's no login.aspx in every folder. Meaning, that default file in every folder will not have the same name and in the Default Document section in IIS I can't choose default document for each folder. Let's say I have pageA.aspx and pageB.aspx in every folder, and in one of these folders pageA.aspx should be default, while in a different folder, pageB.aspx should be default? How can I achieve this? Thanks!!
  • Gonzalo
    Gonzalo almost 13 years
    Hi Rusty. I wasn't able to make this work. I created a new Web.config file in each subfolder as mentioned in the link you provided but when I access /folder it shows directory listing. Maybe removing the web.config file in root folder? Anyway, I solved it through the IIS. I hadn't realized I could select Default Document for each folder. Thanks!
  • Gonzalo
    Gonzalo almost 13 years
    Solved it! I hadn't realized I could select Default Document for each folder. Thanks!
  • unintentionally left blank
    unintentionally left blank over 8 years
    This solution didn't work for me either, I also got a directory listing.
  • Rob Sedgwick
    Rob Sedgwick almost 8 years
    as long as the default document name is the same in each folder (which it is for the OP) there's no need to do anything other than supply the default document name once and that will apply in every folder