locked
Deploy and set a sub folder page as start up page RRS feed

  • Question

  • User1182587605 posted

    I have IIS7. I am working on .NET 4.5. I need to deploy a website where all the pages are in sub folders(not in root folder). In this situation, How can I set the Default document. All my pages are segregated into sub folders as per their necessity. Please help me in this.

    My aspx page which needs to be default page is at

    ~/Transactions/FirstPage.aspx

    How can I make this the default page.

    Regards,

    Deepak

    Wednesday, March 8, 2017 8:13 AM

All replies

  • User753101303 posted

    Hi,
    Crerating a web.config in this folder to define the default document should work: https://www.iis.net/configreference/system.webserver/defaultdocument
    My personal preference would be likely to just name the page default.aspx . Depending on why you have done this you could also have a look at https://www.iis.net/configreference/system.webserver/defaultdocument which would allow to use /transactions and serve the transactions.aspx page (if this is what you are trying to achieve)

    Wednesday, March 8, 2017 8:26 AM
  • User-2057865890 posted

    Hi Deepak,

    To redirect from root to subdirectory.

    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Root Hit Redirect" stopProcessing="true">
                    <match url="^$" />
                    <action type="Rewrite" url="/Transactions/FirstPage.aspx" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

    reference:

    http://stackoverflow.com/a/7031732

    https://blog.discountasp.net/root-redirection-to-subdirectory/

    Best Regards,

    Chris

    Thursday, March 9, 2017 2:17 AM
  • User1182587605 posted

    Should I do this in the root web.config file or as PatriceSc says, Should it be in the sub directory web.config. Please let e know

    Thursday, March 9, 2017 6:54 AM
  • User753101303 posted

    This is not the same approach. One is to change the default document inside this particular folder. The other one is to redirect / http queries to this page.

    As I pointed also :
    - if using default.aspx it would just work
    - I suspect that you are doing that in an attempt to have "clean" urls. You could then try  http://stackoverflow.com/questions/14116477/asp-net-webforms-extensionless-urls and use pages in the root directory.

    For now my understanding is that each page is in its own folder maybe because you wanted to take part of default document to achieve a similar result ???

    Thursday, March 9, 2017 11:35 AM
  • User1182587605 posted

    Yes PatriceSc,

    I understand what you said. As a new guy to these things I didn't understand in the beginning. Thanks by the way.

    Regards,

    Deepak

    Thursday, March 9, 2017 11:37 AM