Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3788214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:57:49+00:00 2026-05-19T11:57:49+00:00

According to MSDN and the MCTS self-paced training, asp.net can use Hidden fields for

  • 0

According to MSDN and the MCTS self-paced training, asp.net can use Hidden fields for client-side state management. The book material goes on to say view-state is more secure than hidden fields because the data is encrypted.

I must be missing something here. I setup a Label and made it hidden. I can store data in this hidden label and it won’t even be sent to the client browser. This not only works like server side state (note the runat=server), but this seems more secure than view-state because there’s no need for encryption as the client can’t even see the field.

<asp:Label ID="Label1" Visible="false" runat="server">secret info</asp:Label>

Contrast this with an HTML input field. Here, the client state info makes sense.

<input id="Text2" type="text" style="visibility:hidden;" value="secret 99" />

So what’s the deal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:57:49+00:00Added an answer on May 19, 2026 at 11:57 am

    When you create a label in .net and set it’s visibility to Hidden, it does not render to the client and its data is stored in viewstate.

    Therefore, it is not “more” secure than viewstate as it is using viewstate to maintain the data.

    Regarding hidden fields, there are four kinds: First up is the regular HTML one which is simply an input of type hidden. This has no visible rendering although it is in the html. It also has no viewstate properties. It is declared as:

    <input id="MyId" type='hidden' value='whatever' />
    

    The second one is a regular input with a css property marking it as hidden: If CSS is disabled or otherwise overriden then the control would be visible to the user. Other than that its pretty close to the same thing as a type=’hidden’.

    <input id='MyId' type='text' value='whatever' style='visibility:hidden' />
    

    The third one is the .Net hidden field. This does has viewstate storage, but it also causes a regular hidden field to be generated in the html.

    <asp:HiddenField id='MyId' runat='server' value='whatever' />
    

    And, the fourth one is a regular .net text box that is marked as not-visible.

    <asp:TextBox id='MyId' runat='server' Text='whatever' Visible='False' />
    

    The .net ones will cause data to be placed in viewstate. The HTML ones do not. If you set Visible=False on a .Net control then it is not rendered to the client however it’s data is typically stored in viewstate.

    There are other ways of throwing data into the page, but they are derivations of the above.

    Generally speaking if you have a value that your javascript code needs but you don’t need to display it to the client then you use a hidden field (html or .net). If you have a secret value then typically you don’t want this to go to the client side if at all possible. And that means even keeping it out of viewstate. As a side note, don’t depend on viewstate “security’ there are tools out there which will easily decrypt it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
According to [MSDN: Array usage guidelines]( http://msdn.microsoft.com/en-us/library/k2604h5s(VS.71).aspx) : Array Valued Properties You should use
According to MSDN : If you did not use the Start method to start
According to How to use .NET PerformanceCounter to track memory and CPU usage per
According to MSDN in .Net DateTimeFormat.MonthName should contain exactly 13 elements with 12 element
According to MSDN Visual C++ can emit C4711 warning: function X selected for inline
CSDL includes elements Documentation/Summary and Documentation/LongDescription that, according to MSDN , can be used
According to MSDN is: The using directive has two uses: 1)To allow the use
According to msdn Enums cannot have a base type of char. Why can enums
According to MSDN documentation, SetupDiGetClassDevs can be passed a device instance ID to obtain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.