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

One thought on “SPUtility.Redirect – to the Layouts directory

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.