How to set a default page to a Windows Azure Web Role App (Silverlight, ASP.NET, etc.)

Cesar De la Torre

 

This is a very easy tip, but useful.
As you may know, Windows Azure management portal has not a way to set many things you could do using IIS Management console. But, because most of the IIS 7.x configuration can be also set using XML configuration files, in most of the cases we don’t really need the IIS Manager.
In this case, we can set a default page to a Windows Azure Web Role App (SIlverlight, ASP.NET, etc.) changing the web.config. We just specify the default page within the System.WebServer section:

<defaultDocument>
              <files>                          
                 <clear/>                          
                 <add value=”MySilverlightInitialPage.aspx”/>                     
              </files>             
</defaultDocument>

Then, your named Silverlight or ASP.NET page will be respected as the default document of the web site, and therefore will be served when the client requests for the root URL (http://mysolution.cloudapp.net/).
Very easy!!

In a similar way, we could specify it per folder (not just the root default page). Instead of specifing it by  “System.WebServer”, you gotta specify the label per “location”. For instance:

<location path=”webFolder1″>
        <system.webServer>
            <defaultDocument>
                <files>
                    <add value=”myDefalutPage.aspx” />
                </files>
            </defaultDocument>
        </system.webServer>
    </location>
    <location path=”webFolder2″>
        <system.webServer>
            <defaultDocument>
                <files>
                    <add value=” myDefalutPage.aspx” />
                </files>
            </defaultDocument>
        </system.webServer>
    </location>

You can get more info here:

 http://msdn.microsoft.com/en-us/library/b6x6shw7(v=VS.90).aspx 

0 comments

Discussion is closed.

Feedback usabilla icon