Setting default website redirect to virtual directory IIS 7

iis-7

I have a virtual directory in IIS 7 called Foo. There is a URL that you can access at mydomain.com/Foo/test.aspx

I would like mydomain.com to automatically go to mydomain.com/Foo/test.aspx but can't seem to find a way to do this in IIS 7 with redirects (it keeps redirecting to mydomain.com/Foo/test.aspx/Foo/test.aspx/Foo/test.aspx/.... if I redirect to Foo/test.aspx or the full address mydomain.com/Foo/test.aspx.

How is this done?

Best Answer

One option is to have a default document with the following content in the site root:

<%@ page language="c#" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("/foo/test.aspx");
    }    
</script>
Related Topic