简体   繁体   English

如何配置IIS 7以使用子目录作为默认文档?

[英]How to configure IIS 7 to use a subdirectory as the default document?

我的网站(Account / login.aspx)的子目录中提供了默认文档,我想将此页面设置为IIS管理器中的默认文档,怎么能做到这一点?

The simplest thing may be to keep your default document in the root with code like this: 最简单的事情可能是使用以下代码将默认文档保留在根目录中:

<%@ Page Language="vb" %>
<% Response.Redirect("~/account/login.aspx") %>

If you don't want the "second round trip" of a redirect you can substitute Response.Redirect with Server.Transfer. 如果您不想进行重定向的“第二次往返”,则可以用Server.Transfer替换Response.Redirect。 In that case the URL will not change in the user's browser. 在这种情况下,URL将不会在用户的浏览器中更改。

Or, if you want you really want the redirect in IIS. 或者,如果您确实要在IIS中进行重定向。 Open IIS Manager, click your web site's node in the left pane, find "Http Redirect" in the main Features View pane and double-click. 打开IIS管理器,在左侧窗格中单击网站的节点,在“功能视图”主窗格中找到“ Http Redirect”,然后双击。 Check the box for "Redirect Requests" then also check the box for "Only redirect requests to content in this directory (not subdirectories)". 选中“重定向请求”框,然后选中“仅将请求重定向到此目录中的内容(非子目录)”框。 Note: the Server.Transfer option is not doable from IIS Manager. 注意:不能从IIS管理器中使用Server.Transfer选项。

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

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