简体   繁体   中英

default.aspx is in a subfolder, use it as startpage on www.mysite.com

I have a problem. The structure for my website looks something like this.

root
web.config
root|aspx|anonymous|default.aspx
root|aspx|members|members.aspx
root|images|.png
root|includes|css

I really dont know if this is the best way to organize.. But since i use roles and the membership provider i want to keep control of the users.

Now to the problem, adress to my website is www.mysite.com and if i put the "default.aspx" directly in the root folder everything works fine. But as it is now the users has to enter www.mysite.com/aspx/anonymous/default.aspx to access the startpage. This is logical since it is where my "default.aspx" is located. But i want to know if i can somehow redirect users comming to www.mysite.com to the real "startpage" www.mysite.com.. And yes default.aspx is SET to be startpage in my VS project.

只需在根文件夹中添加default.aspx并在代码中执行Response.Redirect(“ / aspx / anonymous / default.aspx”)

Another way:

<configuration>
   <system.webServer>
      <defaultDocument enabled="true">
         <files>
            <add value="/aspx/anonymous/default.aspx" />
         </files>
      </defaultDocument>
   </system.webServer>
</configuration>

http://www.iis.net/ConfigReference/system.webServer/defaultDocument

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