SPUtility.Redirect – to the Layouts directory

I always find myself having to look this stuff up, and it’s nearly always for the same format of redirect, so here’s a reminder for myself. In SharePoint, you can redirect to a page in Layouts (in this case, the site settings page) with:

SPUtility.Redirect("settings.aspx", SPRedirectFlags.Static | SPRedirectFlags.RelativeToLayoutsPage|SPRedirectFlags.UseSource, HttpContext.Current);

This also will redirect to a &source= get parameter if available. It also deals with the HIVE number (/15/) in the URL automatically.


SPUtility.Redirect – to the Layouts directory