简体   繁体   English

default.aspx在子文件夹中,用作www.mysite.com上的起始页

[英]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. 现在解决问题,访问我的网站是www.mysite.com,如果我将“ default.aspx”直接放在根文件夹中,则一切正常。 But as it is now the users has to enter www.mysite.com/aspx/anonymous/default.aspx to access the startpage. 但是,现在,用户必须输入www.mysite.com/aspx/anonymous/default.aspx才能访问起始页。 This is logical since it is where my "default.aspx" is located. 这是合乎逻辑的,因为这是我的“ default.aspx”所在的位置。 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. 但是我想知道我是否可以以某种方式将到www.mysite.com的用户重定向到真正的“起始页” www.mysite.com。。是的,default.aspx被设置为我的VS项目中的起始页。

只需在根文件夹中添加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 http://www.iis.net/ConfigReference/system.webServer/defaultDocument

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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