Fix blog permissions viewstate#225
Open
Forro-54 wants to merge 3 commits into
Open
Conversation
Prevent restoring dynamically generated permission-grid child ViewState after Blog permission changes.
## Summary This pull request fixes a ViewState exception that occurs when editing Blog settings after Blog permissions have been changed. The issue is caused by `BlogPermissionsGrid` saving and restoring the ViewState of dynamically generated child controls. After permission changes, the generated control tree can differ between requests, causing ASP.NET to throw: ``` Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. ``` ## Root cause `BlogPermissionsGrid` persisted the base child-control ViewState: ```csharp allStates[0] = base.SaveViewState(); ``` and later restored it using: ```csharp base.LoadViewState(myState[0]); ``` Because the permissions grid is dynamically generated, the child-control structure can legitimately change after permission updates, making the stored ViewState invalid. ## Fix - Do not persist dynamically generated child-control ViewState. - Continue to persist: - Blog ID - Current User ID - Blog permission collection - Rebuild the permissions grid on each request. ## Testing Verified successfully on DNN Platform 10.3.2 / .NET Framework 4.8. Tested by: - Editing existing Blogs - Creating a second Blog - Repeated Blog permission changes - Updating Blog settings - Creating posts - Editing posts - Uploading images to posts The fix was also validated on a production site running the unmodified Blog 6.7.1 release by replacing only `DotNetNuke.Modules.Blog.Core.dll`.
…hanges Tested successfully on DNN Platform 10.3.2 / .NET Framework 4.8 with SQL Server. Verified by: editing existing Blogs creating a second Blog repeated permission changes changing Blog settings creating and editing posts uploading images validating on a production site running the stock Blog 6.7.1 release
Author
|
I hope this is done right and the fix helps. |
Member
|
@Forro-54 any reason for closing the PR? |
Author
|
Sorry my bad. |
Author
|
Again, Sorry my bad. Kind Regards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #224
Description of PR...
Changes made
PR Template Checklist
Please mark which issue is solved
Close #