Set default page for .net web-application

18,688

Solution 1

If you are using the Visual Studio Development web server, you cannot specify a default page that will be served up when you navigate to "/". It is hardwired to use "Default.aspx" ... this has been a standard page for a great long time and there should be little reason to deviate from it.

What you can do is create a blank Default.aspx page and perform a Server.Transfer() on page load.

If you absolutely must specify a different start up page, and cannot create a Default.aspx page, then you must abandon the development server and opt to use IIS locally or use IIS Express, either should be able to debug applications, but may have features that require configuration.

Solution 2

To set the start up page in asp.net:

  1. Right click in Solution explorer on the main folder name.

  2. Select Property page. Property page window will appear in front of you.

  3. Select ‘start option’. Then select ‘Specific page’ radio button. Click of on the browser button which is right after the textbox of specific page.

  4. "Select page to start" Window appears in front of you. Select the page name which you want to set as start up web page. Click “OK”.

  5. You should be back to ‘Property pages’ window. Click OK. Now Debug the page. You have set the start up page.

Solution 3

In Visual Studio, right click on default.aspx and click 'Set as Start Page'. I'd recommend upgrading to .NET 4 if you're able to, but that would require updating your Visual Studio to 2010. 3.5 works with VS 2008.

Solution 4

You need to set the startup page.

Select the aspx page that's to be the startup page.

Right click over it and select "Set as Start Page".

Solution 5

Is your site hosted in your local IIS? In other words if you go to IIS on your machine is there a website or a virtual directory for your web application? If so you may need to make sure that the default documents list contains an entry for default.aspx.

Share:
18,688
AGuyCalledGerald
Author by

AGuyCalledGerald

I am a .Net web developer with eager interest in HTML 5, CSS 3, jQuery and all tools and techniques that help enhance frontend development. I also like graphic design.

Updated on June 04, 2022

Comments

  • AGuyCalledGerald
    AGuyCalledGerald about 2 years

    I developed a .net web-application. If I start the development server in the browser like this:

    http://localhost:<host number>/
    

    I get to a directory listing. I would rather get to a specific default page. In my case it´s located in the folder Applications/Default/ of the project and named default.aspx .

    I use .net 2.0 and VS 2005.

  • AGuyCalledGerald
    AGuyCalledGerald over 12 years
    Nothing happens! I still get to the directory listing.
  • AGuyCalledGerald
    AGuyCalledGerald over 12 years
    No, I still get to the directory listing.
  • AGuyCalledGerald
    AGuyCalledGerald over 12 years
    I use the visual studio development server, not the local IIS.
  • Ricky Smith
    Ricky Smith over 12 years
    Also note that the development web server hosts your application within a virtual directory, not in the root of the site. If your website project is named "MyWebsite" then it will appear in "/MyWebsite/" and never at "/".
  • AGuyCalledGerald
    AGuyCalledGerald over 12 years
    Ah, this works! If I add a page called Default.aspx at the root of my application, this page is opened. This is ok for my needs.
  • Dissident Rage
    Dissident Rage almost 12 years
    "...this has been a standard page for a great long time and there should be little reason to deviate from it." According to who?
  • Ricky Smith
    Ricky Smith almost 12 years
    default.aspx has been the default page name for ASP.NET websites since the beginning of ASP.NET. Other default page names include, but are not limited to: default.asp, default.htm, and default.html. You can configure web servers to use other default pages, so that the webservice looks for whatever page you want when a page name is omitted, but these are the pre-configured values. "... there should be little reason to deviate from it" is an opinion, but I believe a common one.
  • FrenkyB
    FrenkyB over 8 years
    Works like a charm! Thank you.