Thanks for taking a look.
I have a text box and a button on a SharePoint aspx page which will update the current SPWeb's title. The control then redirects the user to a different .aspx page in the same Web.
The web title gets updated, and all processing behaves as normal. The problem is that on this initial redirect the QuickLaunch and breadcrumb still display the old title. Only after the user manually refreshes one time do the QuickLaunch and breadcrumb elements get updated.
Here is the code:
public string ChangeWebTitleElevated(string webUrl, string newTitle)
{
string updatedTitle = "";
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(webUrl))
{
using (SPWeb web = site.OpenWeb())
{
web.Title = newTitle;
web.AllowUnsafeUpdates = true;
web.Update();
web.AllowUnsafeUpdates = false;
updatedTitle = newTitle;
}
}
});
}
catch(Exception ex)
{
Logging.LogError("ChangeWebTitleElevated: webUrl: " + webUrl + ", New Title: " + newTitle + ", Exception: " + ex.ToString());
}
return updatedTitle;
}
protected void SaveProfileClick(object sender, EventArgs e)
{
ChangeWebTitleElevated(SPContext.Current.Web.Url, "New Web Title");
//Response.Expires = -1;
//Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.Redirect(SPContext.Current.Web.Url + "/pages/home.aspx");
SPUtility.Redirect(SPContext.Current.Web.Url + "/pages/home.aspx"), SPRedirectFlags.Static, HttpContext.Current);
}
As you can I've done some investigation around caching with a Response.Redirect (using Expires=-1 and SetCacheability) but they all showed the same issues.
Does anyone know of a workaround for this? Thank you in advance.
-Phillip