I have finally resolved this issue. Basicall, I need to overwrite "System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" class with my own custom class. I simply need to do some tricks when I get or set path. I now can put web part in the master pages, drag, minimize, etc and when I navigate to a different page, the same display will be shown. I have included the code here and hope this can be helpful for others who might need it. You just need to ensure the web.config is pointing to this custom class for personalization.
Web.Config:
<webParts>
<personalization defaultProvider="SqlProvider">
<providers>
<clear/>
<add name="SqlProvider" type="CustomSqlPersonalizationProvider" connectionStringName="ConnectionString"/>
</providers>
</personalization>
</webParts>
Custom SqlPersonalization:
public
class CustomSqlPersonalizationProvider : SqlPersonalizationProvider
{
private string GetPath
{
get
{
return "default.aspx";
}
}
protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{
base.LoadPersonalizationBlobs(webPartManager, this.GetPath, userName, ref sharedDataBlob, ref userDataBlob);
}
protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
{
base.SavePersonalizationBlob(webPartManager, this.GetPath, userName, dataBlob);
}
protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)
{
base.ResetPersonalizationBlob(webPartManager, this.GetPath, userName);
}
}