views:

4134

answers:

3

when I visit http://mywebsiteurl.com/ by default it will load Default.aspx, index.html, or welcome.html... I would like to know how I can make a directory point to index.ashx (or something else other then index.html) is it inside the web.config file?

+2  A: 

If it's IIS7, you can add the following to your web.config ...

<configuration>   
  <system.webServer>
     <defaultDocument>
        <files>
          <add value="index.ashx" />
        </files>
      </defaultDocument>
  </system.webServer>
</configuration>

More on that here. If it's a previous version, you need access to IIS Manager to do it. Here's how.

JP Alioto
+1  A: 

I've never used godaddy as a host, but if you are not on IIS7 and can't change the default files, you could also use the web.config to re-map Default.aspx to whatever handler you wanted:

<httpHandlers>
  <remove verb="*" path="Default.aspx" />
  <add verb="*" path="Default.aspx" 
       type="The.Type.Of.My.Handler, The.Assembly.Of.My.Handler" />
</httpHandlers>

In some ways this is cleaner than using the control panel to re-point the page as it is now part of your application's code base and not an environmental dependency, so you won't need to do things like make sure to repeat the configuration change on your development or QA environments.

Wyatt Barnett
This looks like a useful solution as GoDaddy only seems to allow setting a default document if you have their 'Deluxe' or 'Premium' windows hosting accounts :(
mdresser
A: 

The solution is, right click on the page you want to be your start up page in the Solution Explorer and select "Set as Start Page".

Joao Ribeiro
I don't think that has any impact on the startpage on the hosting server.
magnus
That is only the page that will open when you run your project from within visual studio. It has no effect on a deployed project.
Fishcake