Alex
Alex

Reputation: 3405

Setting Default WebPage in IIS 7.5

I'd a HD problem in machine where my Intranet IIS server was installed and I've reinstalled all the software. I've restored the site data into new IIS but now, when I type the server address in a browser in a client or even server machine, it doesn't find the page ("Default.aspx"). I can allow "Directory browsing" and click the file but, obviously, I don't want this alternative, neither obligating users to type "Default.aspx" in the end of the URL.

Maybe it's a very simple configuration, but I've cannot found it in IIS.

Upvotes: 5

Views: 29729

Answers (4)

Himanshu Das
Himanshu Das

Reputation: 31

I was looking for the answer of same question. But these line helped me to achieve goal.

  <system.webServer>
        <httpRedirect enabled="true" destination="/Pages/ABC/xyz/" childOnly="true" />
        <defaultDocument>
            <files>
                <add value="~/Default.aspx"/>
            </files>
        </defaultDocument>
  </system.webServer>

Upvotes: 2

Fredrik
Fredrik

Reputation: 76

Had the same problem in MVC project where I have put a default.aspx in the root
It was not enough to only set web.config

<system.webServer>
<defaultDocument enabled="true">
    <files>
        <clear />
        <add value="Default.aspx" />
    </files>
</defaultDocument>
</system.webServer>

Also had too add routes.IgnoreRoute(""); in RouteConfig.cs

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("");
        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }

I followed the guide: http://weblog.west-wind.com/posts/2013/Aug/15/IIS-Default-Documents-vs-ASPNET-MVC-Routes

Upvotes: 2

keremispirli
keremispirli

Reputation: 3502

When you select your website or application in the left panel, there is an icon named "Default Document" on the middle, under IIS title. That is where that configuration is made from IIS Manager. Current default documents are listed and new ones can be created by clicking Add link on the Actions panel on right.

Upvotes: 3

Thomas
Thomas

Reputation: 64674

Put the following in site's or application's web.config file:

<system.webServer>
    <defaultDocument>
        <files>
            <add value="~/Default.aspx"/>
        </files>
    </defaultDocument>
</system.webServer>

Upvotes: 4

Related Questions