Web Farm and <machineKey>

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Web Farm and <machineKey>

    I have a Web Farm and I understand that in order to keep
    ViewState safe I want to modify the <machineKey>.

    1) The documentation indicates that EnableViewStateMac
    defaults to "false" but I am seeing View State corruption
    messages (as a result of HttpException). Can the View
    State be detected as corrupt without the MAC validation?

    2) I see some examples of some keys that I can use for
    validation and encryption. Is there a utility that I can
    use to generate a key? Yes, I understand that the same key
    has to be on each member of the Web farm. I would just
    like to generate my own key.

    3) Is the default to encrypt and hash or just hash or none?

    Thank you.

    Kevin
    [email]rkevinburton@charter.net[/email]

    Kevin Burton Guest

  2. Similar Questions and Discussions

    1. Session Timeout and Web Farm
      Hi Folks, I am creating a web service that will be hosted on a web farm. The web service also uses sessions to store user specific data. I have...
    2. Changing machineKey in live production site
      In an effort to address ViewState invalid errors, I want to set the machineKey element in web.config on my two web servers. (The load balancer...
    3. alpaca Farm site
      'www.nuclearfusion.com.au/alpaca.htm (http://www.nuclearfusion.com.au/alpaca.htm) tell me what you think - I've just started making it, the...
    4. Web Farm
      Scenario is load balancer and two machines(1&2) in production. Out of state session server on another machine (Session). Works perfectly. ...
    5. Clustered web farm
      Hi, Is it possible to redirect user to same webserver in clustered web farm until his session ends?
  3. #2

    Default Re: Web Farm and <machineKey>

    Hi,

    1. Docs are incorrect here. enableViewStateMac="true" is the default.

    2. [url]http://www.eggheadcafe.com/articles/20030514.asp[/url]

    3. By default both validationKey and decryptionKey are autogenerated which
    means both techniques are applied as well.

    You could also take a peek at docs about <machineKey> though the article at
    answer 2) covers those also.
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfmachinekeysection.asp[/url]

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "Kevin Burton" <anonymous@discussions.microsoft.com> wrote in message
    news:033901c39f32$08cf2440$a401280a@phx.gbl...
    > I have a Web Farm and I understand that in order to keep
    > ViewState safe I want to modify the <machineKey>.
    >
    > 1) The documentation indicates that EnableViewStateMac
    > defaults to "false" but I am seeing View State corruption
    > messages (as a result of HttpException). Can the View
    > State be detected as corrupt without the MAC validation?
    >
    > 2) I see some examples of some keys that I can use for
    > validation and encryption. Is there a utility that I can
    > use to generate a key? Yes, I understand that the same key
    > has to be on each member of the Web farm. I would just
    > like to generate my own key.
    >
    > 3) Is the default to encrypt and hash or just hash or none?
    >
    > Thank you.
    >
    > Kevin
    > [email]rkevinburton@charter.net[/email]
    >

    Teemu Keiski Guest

  4. #3

    Default RE: Web Farm and <machineKey>

    The purpose of the View State MAC feature is to make it impossible for
    clients to send a request containing malicious View State. This feature is
    enabled by default, via the enableViewStateMac="true" flag in your
    machine.config. The simplest way to determine whether the issue you are
    dealing with is related to the MAC is to turn off the feature, by setting
    enableViewStateMac="false". If you no longer get View State errors, then
    the problem is MAC related.

    The viewstate error can be caused due to an underlying exception not being
    handled properly.

    One of the prominent causes of this error in a web farm environment is the
    fact that the validation key is left as AutoGenerate.
    In a Web Farm, each client request can go to a different machine on every
    postback. Because of this, you cannot leave the validationKey set to
    'AutoGenerate' in machine.config. Instead, you must set it to a fixed
    string that is shared among all the machines on the Web Farm.


    The following article tells you how to create the keys.
    313091 HOW TO: Create Keys by Using Visual Basic .NET for Use in Forms
    [url]http://support.microsoft.com/?id=313091[/url]

    Hope this helps.
    Imtiaz Hussain.

    Imtiaz Hussain Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139