Hello,

I wanted to know as to how to pass an object of a class with a number of member variables across aspx pages.

It depends?
If it depends on users and secure data -> Session
If it depends on users and not secure data -> Cookies
If it doesn't depend on users -> Cache or Application variables
It just hints and I may be wrong please ask questions related to asp.net in ASP.NET forum http://www.daniweb.com/forums/forum18.html

i think the items Ramy mentioned are not good. Use cross-page posting or write the data in database and request it on the other page.

Thanks, Serkan :D

You could also use a hidden input, serialize the object, and POST data to another page

there is also server.transfer method which keeps the viewstate. so you can serialize the object in viewstate and the read it in the next page(response.redirect wont work in this scenario, only server.transfer).

but as i said, best is either crosspage posting or using database. just pass the id of that object and grab it from the database in the next page.

Both are not the best way!
1- viewstate not for secure data
2- database not for small objects
Before giving a consulting, ask more questions...

Both are not the best way!
1- viewstate not for secure data
2- database not for small objects
Before giving a consulting, ask more questions...

my best way suggession do not include first item. i said either crosspage posting or database. last year i work in Turkey's biggest e-commerce web application with over milion visits a day. We used to write everything to database. i dont know your experiences though :)

Ramy the competitor Mahrous :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.