GridView controls and hidden columns

  • Thread starter Thread starter Mark Rae
  • Start date Start date
The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.

The workaround is to add to the gridview attribute
datakeynames=[myhiddendatavalue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate and
performance you should keep in mind also.

Peter Kellner
http://peterkellner.net
 
The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.

Seems reasonable.
The workaround is to add to the gridview attribute
datakeynames=[myhiddendatavalue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate
and performance you should keep in mind also.

Understood - thanks for the response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top