简体   繁体   中英

Web.config changing file default location

I've have a tricky question for you:

In Visual C# IDE , how do you change the location of a file within a seperate folder?

So for example

The inital path of this folder was Webproject/folder1/Default.aspx in VS 2008, I converted this to 2010 and needed to rename the Default.aspx to folder1Default.aspx to make it work in 2010, because I couldnt have more than one Default.aspx. Now when I attempt to navigate to this folder, it can't open this as the default page. How can I set this page to be the default location for this specific folder?
If the path were Webproject/folder1/folder1Default.aspx, how could I change this location using the web.config file?

Thanks.

You did this, but there should be only 1 default or index file which are defined in IIS or config file.

<location path="folder1">
     <system.webServer> 
       <defaultDocument enabled="true">
         <files> 
          <add value="folder1Default.aspx"/> 
         </files> 
       </defaultDocument> 
     </system.webServer> 
    </location>

I have done it like this in config file

<system.webServer>
    <defaultDocument>
      <files>
        <remove value="default.aspx" />
        <remove value="iisstart.htm" />
        <remove value="index.html" />
        <remove value="index.htm" />
        <remove value="Default.asp" />
        <remove value="Default.htm" />
        <add value="folder1Default.aspx" />
      </files>
    </defaultDocument>
  </system.webServer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM