What is the _layouts/15/start.aspx in SharePoint 2013

SharePoint 2013 immediately redirects you to an application page start.aspx when you call a website.

If you’ve ever wondered why, keep on reading… image

image

The pictures will also look familiar to you. So what happened? Why the start.aspx?

The start.aspx inherits Microsoft.SharePoint.ApplicationPages.MDSStartPage. That page simply looks, if the SPContext.Current.Site.CompatibilityLevel is above 14. If not, it’ll redirect to web.Url. That is the behavior, we know from previous versions of SharePoint.

Additionally it adds some caching information to the Response, and loads a JavaScript called… start.js. That file contains a method $_global_start, which is executed after the file has been loaded. There are some steps the JavaScript executes. Next I’ll try to tell you what the most important steps are.

The arrow basically shows what happens if a user requests a page, where the new logic has been implemented.

image

Next, I will write a little bit about each step. Don’t expect an in-deep explanation. This is just an overview to satisfy the first curiosity.

The Start.js

Show “Working on it…” either full-size for a newly called page, or a smaller one on the right side

But who calls the script? The answer is: the mighty masterpage.

The script does some magic to the Url. I’ll check for updates, which have to be loaded an passed to the client and modify the Url (inserts _layouts/15/start.aspx). If you want to take a closer look on what the script does, set a Breakpoint with e.g. Firebug on the line “function AsyncDeltaManager$_navigate(url, anchorName, bUpdatehash) {“ and reload a page.

The v5.master

SharePoint 2013 brings a new masterpage, which is called v5.master. That masterpage contains a control of type StartScript.

<SharePoint:StartScript runat="server" />

The TagPrefix SharePoint reflects the namespace Microsoft.SharePoint.WebControls. So lets look into the class.

The StartScript WebControl

If the current Page is of type DeltaPage, the class adds some JavaScript to the Page.

To shorten up here as well: If there is a hash in the Url (#), the script will tell the AsyncDeltaManager (from start.js) to hook up to the submit event and tell it where it needs to redirect in case of a postback.

That’s basically all the WebControl is doing.

The DeltaPage

The DeltaPage inherits System.Web.UI.Page. It decides, whether to render the full page, or just a delta. This is called the “Minimal Download Strategy”. There are already some interesting posts about this available. SharePoint 2013 – Introduction to the Minimal Download Strategy (MDS) or Minimal Download Strategy in SharePoint 2013

protected override void Render(HtmlTextWriter writer)
{
    if (this.RenderDelta)
    {
        this.RenderForRenderDelta(writer);
    }
    else
    {
        this.RenderToBase(writer);
    }
}

RenderDelta will look if the current page is the StartPage (that means there is no Page on which to depend)  or if SPContext.Current.Web.EnableMinimalDownload has not been enabled. RenderForRenderDelta add “pageStartRedirect” to the response. I won’t go into the details of this, because I simply haven’t looked into it deep enough for a blog post.

Summary

This image should visualize the steps.

image

Please keep in mind, that this post is written with a research on SharePoint 2013 preview!

There are plenty more features which I’d like to take a deeper look into. Let’s hope I find the time to do so 🙂