简体   繁体   English

转到网站根目录时,Web.config重定向到页面

[英]Web.config redirect to page when going to site root

Web.config redirect to page when going to site root; Web.config在转到网站根目录时重定向到页面;

Perhaps a bit of an odd requirement but i need to redirect anyone going to the domain root to a given page, but only on the domain root. 也许有点奇怪的要求,但是我需要将任何人都重定向到域根目录到给定的页面,但只能在域根目录上。

for instance: 例如:

http://example.com redirects to http://example.com/page/details/5 http://example.com重定向到http://example.com/page/details/5

however; 然而;

http://example.com/contact shouldnt be effected. http://example.com/contact不受影响。

I can't find anything specific through google, though its possible im not understanding what im seeing.. 我无法通过Google找到任何具体的信息,尽管可能是因为我不了解自己在看什么。

Any help would be greatly appreciated! 任何帮助将不胜感激!

Just put a default.aspx page in the site root with the following code: 只需使用以下代码将default.aspx页放入站点根目录:

<script runat="server">
void Page_Load(object sender, EventArgs e) {
    Response.Redirect("/page/details/5");
}
</script>

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

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