简体   繁体   中英

Web.config redirect to page when going to site root

Web.config redirect to page when going to site root;

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

however;

http://example.com/contact shouldnt be effected.

I can't find anything specific through google, though its possible im not understanding what im seeing..

Any help would be greatly appreciated!

Just put a default.aspx page in the site root with the following code:

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

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