WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(this.Page);
if (wpm.DisplayMode.AllowPageDesign)
{
this.Controls.Add(new Literal(“edit mode”));
}
else
{
this.Controls.Add(new Literal(“not edit mode”));
}
Thanks to http://www.neilrichards.net/blog/?cat=12 I was able to use this to allow a user to append a querystring on to the URL to prevent a redirect.