I am developing a web application in asp.net. I am using a class with property fields to store data. And I want access that property field in another asp page without using Session
. Is there any way to pass the class object from one aspx.cs
page to another (like query string). When I tried to pass it through query string and when I tried to access it one another page, I got the compile time error 'cannot convert type to 'class' type'
.
Asked
Active
Viewed 1,335 times
0

Tolga Evcimen
- 7,112
- 11
- 58
- 91

NCA
- 810
- 1
- 8
- 19
-
you should have your users data in `Session`, and you can dispose the session fields you don't want anywhere. `ViewState` is not a valid option for that kind of use. – Tolga Evcimen Dec 05 '13 at 08:19
-
Here is an answer using post data http://stackoverflow.com/questions/5804549/passing-variables-to-a-new-page-when-clicking-submit/5804721#5804721 – Aristos Dec 05 '13 at 08:24
1 Answers
0
You can do it two ways:
- Serialize the object to a string and pass it through the query string (POST body better though)
- Serialize the object into a JSON and pass it through the POST body.
I recommend to use the second option. However, you should reconsider the question, might be, there is better approach to your root issue.

AgentFire
- 8,944
- 8
- 43
- 90