-
Notifications
You must be signed in to change notification settings - Fork 42
Add ASP.NET State Helpers #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces ASP.NET state management helpers to simplify interaction with ASP.NET applications that use hidden form fields for state preservation. The helpers parse and track common ASP.NET state parameters (__VIEWSTATE, __VIEWSTATEGENERATOR, __EVENTVALIDATION, __EVENTARGUMENT, __EVENTTARGET, __LASTFOCUS) across request chains, eliminating manual parsing and reducing boilerplate code.
Key changes:
- New
aspnet.Statestruct to track ASP.NET hidden form field values across requests - Helper methods to convert state to parameters, merge with custom parameters, and update from HTML responses
- Comprehensive test coverage validating state parsing and updates across multiple page states
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| aspnet/aspnet.go | Core implementation with State struct and helper methods (AsParams, MergeParams, Update) |
| aspnet/aspnet_test.go | Test suite validating state parsing, parameter conversion, and merging functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
j-baines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think event.EventArgument vs. event.EventTarget needs to be looked at (and an associated test written if that is bugged). Otherwise, this seems good (and I'd just ignore the old man complaining about dependencies).
Adds a set off helper functions to help chain ASP.NET application state management functions. Historically, ASP.NET apps have been a bit of a nuisance to work with because of the way that each page gets set with a
__VIEWSTATEand friends that had to be parsed and set and cased manually. In order to speed up this process this adds a set of functions to be able to parse and update state.The following parameters are extracted when
Updateis called with a HTML document body:For example from our tests in these additions: