Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the default page for ASP.NET (Visual Studio) server configuration

When I build and run my application I get a directory listing in the browser (also happens for sub folders), and I have to click on Index.aspx. It's making me crazy.

Visual Studio 2008 ASP.NET Development Server 9.0.0.0

like image 887
Dan Williams Avatar asked Jul 14 '09 13:07

Dan Williams


People also ask

How do I change the default page in asp net?

Right Click on your desired Page and Select Set As Start Page. But what if for Websites that are hosted on IIS. If there is Default. aspx, it would render first.

How do I change the default page in ASP NET MVC?

You can set up a default route: routes. MapRoute( "Default", // Route name "", // URL with parameters new { controller = "Home", action = "Index"} // Parameter defaults ); Just change the Controller/Action names to your desired default.

How do I change the default login page?

u can do this simply by right clicking on ur singin. aspx page and set it as ur start page. The default sign-in page is done in the config file authentication/authorisation sections.


2 Answers

Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.

like image 75
James Conigliaro Avatar answered Sep 21 '22 00:09

James Conigliaro


The built-in webserver is hardwired to use Default.aspx as the default page.

The project must have atleast an empty Default.aspx file to overcome the Directory Listing problem for Global.asax.

:)

Once you add that empty file all requests can be handled in one location.

public class Global : System.Web.HttpApplication {     protected void Application_BeginRequest(object sender, EventArgs e)     {         this.Response.Write("hi@ " + this.Request.Path + "?" + this.Request.QueryString);         this.Response.StatusCode = 200;         this.Response.ContentType = "text/plain";          this.Response.End();     } } 
like image 24
zproxy Avatar answered Sep 22 '22 00:09

zproxy