Why ASP.NET MVC bothers to have a Default.aspx file?

When create a new ASP.NET MVC project in Visual Studio 2008, there is a Default.aspx page by default. It has one line

<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%>

In its Page_Load function, it just redirects to "/" to go through the routing procedure.

    public void Page_Load(object sender, System.EventArgs e)
    {
        HttpContext.Current.RewritePath(Request.ApplicationPath);
        IHttpHandler httpHandler = new MvcHttpHandler();
        httpHandler.ProcessRequest(HttpContext.Current);
    }

I tried to remove Default.aspx and it turns out that the default URI "http://localhost:2574/" is still accessible. So, why bother to have such Default.aspx?

Answers


Older versions of IIS need a startup document and it also gives you something to right-click on to get the "View in Browser" option.


Need Your Help

Problems with PHPUnit (Linux) - PHP Fatal Error

php linux unit-testing netbeans phpunit

I successfully installed PHPUnit on my desktop PC and decided to have it on my laptop PC, but... then I try to create PHPUnit test Netbeans throws an error "Selected PHPUnit (version ?.?.?) is to o...

Where do I use delegates?

oop design-patterns delegates

What are some real world places that call for delegates? I'm curious what situations or patterns are present where this method is the best solution. No code required.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.