Puzzled about viewstate error

Discussion in 'ASP .Net' started by jeff29_b@yahoo.com, Sep 13, 2005.

  1. Guest

    We have in our site the pages tag in the webroot tag like so.

    <pages enableViewState="true" enableViewStateMac="false" />

    But we are still getting errors during
    LoadPageStateFromPersistenceMedium.

    The stack trace is like so -


    at System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf,
    Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)

    at System.Web.UI.LosFormatter.Deserialize(String input)

    I thought, that if enableViewStateMac was false that it wouldn't try
    and decode the data and just base64 encode the view state so the above
    method getdecodeddata wouldn't be called. Or am I wrong on that?
    Also, we have the same machineKey in the file in the server farm.
     
    , Sep 13, 2005
    #1
    1. Advertising

  2. Bruce Barker Guest

    enableViewStateMac = false, just turns off using the servers's mac address
    as part of the encryption key. you can gererate your own key, and place it
    in the config (as must be done for a web frame).


    -- bruce (sqlwork.com)


    <> wrote in message
    news:...
    > We have in our site the pages tag in the webroot tag like so.
    >
    > <pages enableViewState="true" enableViewStateMac="false" />
    >
    > But we are still getting errors during
    > LoadPageStateFromPersistenceMedium.
    >
    > The stack trace is like so -
    >
    >
    > at System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf,
    > Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
    >
    > at System.Web.UI.LosFormatter.Deserialize(String input)
    >
    > I thought, that if enableViewStateMac was false that it wouldn't try
    > and decode the data and just base64 encode the view state so the above
    > method getdecodeddata wouldn't be called. Or am I wrong on that?
    > Also, we have the same machineKey in the file in the server farm.
    >
     
    Bruce Barker, Sep 13, 2005
    #2
    1. Advertising

  3. Guest

    I don't think that is correct. I have already generated my own
    encryption key using the machineKey tag in the web.config.

    According to the documentation,
    "EnableViewStateMAC - Specifies whether ASP.NET should run a message
    authentication code (MAC) on the page's view state when the page is
    posted back from the client. A view state MAC is an encrypted version
    of the hidden variable that a page's view state is persisted to when
    sent to the browser. If true, the encrypted view state is checked to
    verify that it has not been tampered with on the client."

    My interpretation is that if this is disabled it doesn't encrypt the
    viewstate that is set to the hidden variable, hence, getdecodeddata
    shouldn't be called.
     
    , Sep 13, 2005
    #3
  4. Guest

    Addendum: Here is the text from msdn on the machineKey entry

    "Specifies the key used for validation of encrypted data. validationKey
    is used when enableViewStateMAC is true to create a message
    authentication code (MAC) to ensure that view state has not been
    tampered with. validationKey is also used to generate out-of-process,
    application-specific session IDs to ensure that session state variables
    are isolated between sessions."
     
    , Sep 13, 2005
    #4
  5. Bruce Barker Guest

    but if you look at the code (aways the source), you will see its always
    encrypted, there are just 3 encryption methods, and ways to set the keys.

    -- bruce (sqlwork.com)


    <> wrote in message
    news:...
    > Addendum: Here is the text from msdn on the machineKey entry
    >
    > "Specifies the key used for validation of encrypted data. validationKey
    > is used when enableViewStateMAC is true to create a message
    > authentication code (MAC) to ensure that view state has not been
    > tampered with. validationKey is also used to generate out-of-process,
    > application-specific session IDs to ensure that session state variables
    > are isolated between sessions."
    >
     
    Bruce Barker, Sep 14, 2005
    #5
  6. Guest

    No, that isn't correct. It isn't encrypted it is base64encoded. There
    is a difference there one you need a machinekey to decode with the
    other one you don't.
     
    , Sep 14, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Andrew

    VHDL: puzzled beginner

    Mark Andrew, Jun 27, 2004, in forum: VHDL
    Replies:
    5
    Views:
    647
    Mark Andrew
    Jun 30, 2004
  2. Daniel

    still puzzled

    Daniel, Jun 8, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    659
    Steven Cheng[MSFT]
    Jun 9, 2004
  3. schiefaw

    Very Puzzled, Please Help

    schiefaw, Jul 22, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    384
    schiefaw
    Jul 22, 2005
  4. EvelynAnd Ethan
    Replies:
    4
    Views:
    986
    =?Utf-8?B?Sko=?=
    Jan 9, 2006
  5. Jedrin

    puzzled by yaml error ..

    Jedrin, Jul 21, 2011, in forum: Ruby
    Replies:
    0
    Views:
    567
    Jedrin
    Jul 21, 2011
Loading...

Share This Page