Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
    
This may have something to do with caching? Is it possible to refresh their cache programatically? Just a thought. –  Mike Dec 10 '12 at 22:54
    
I can look into this, but my assumption is that if client caching is indeed the case, then a simple refresh would not solve the issue. The client would have to flush cache before he/she would be able to see changes. In this example, the user just refreshes and the QL shows up correctly. –  phil Dec 10 '12 at 23:16
add comment

1 Answer

up vote 0 down vote accepted

The client ended up being OK with the delay and having to refresh for changes to take affect. We added a message: "please allow a few moments.." etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.