Here´s my predicament. I have an Assignment.aspx custom application page. On this page I´m calling a web service to fetch an assignment object from the SQL server. This object is fairly big and takes about a second to fetch. I am then saving this assignment object in the httpcontext to use it to display information on the different controls in the page.
One of these controls displays the list of tasks that the assignment contains, and each list item will open a dialog pointing to the task page when clicked.
The issue I´m having is that I need the assignment object to be available on the task page, and would like to avoid fetching it again so the performance does not take a hit.
The question is: how do I pass the object from the assignment page to the task page that´s being opened inside a dialog?
What I have tried
- Saving the assignment object in a session variable This works, but I´d like to avoid it if possible. On one hand I´d need a bunch of extra logic to ensure the right object is in the session. On the other hand, well, session state is disabled by default so I´d like to keep it like that if possible
- Serializing the object and passing it in the url. No go. One of the attributes of the assignment object is an ICollection so I get an error when trying to serialize.
- Trying to read from Page.PreviousPage. but it is null, I´m guessing because it is being opened inside a dialog
Update I managed to serialize server side, fetch the variable client side, pass it in the modal arguments and fetch it inside the modal. However, I need it server side again, and when I try to post it back to the server I get a 500, I´m guessing because the variable is just too big (using an ajax call that works just fine when I post a simple string)