简体   繁体   中英

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. In that case the URL will not change in the user's browser.

Or, if you want you really want the redirect in 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. 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.

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