Getting current MachineKey, or equivilent, for HMAC (in web-farm)

前端 未结 1 536
情歌与酒
情歌与酒 2021-01-13 15:21

I am using HMACSHA256 for message authentication in a web-farm environment.

Within the web-farm each machine has the same machine key, so the ViewState will work acr

相关标签:
1条回答
  • 2021-01-13 15:34

    You can read the machine key from the web.config. This link shows how to do so: http://aspnetresources.com/blog/how_to_read_auto_generated_machinekey

    Keep in mind, that the author of the article reads the generated machine key - so you have to do some changes in the code.

    I just read the article a little bit more and saw, that it uses reflection, which isn't neccessary, if you store the machine key inside the web.config. Essentially it breaks down to this line:

    MachineKeySection section = (MachineKeySection) 
      ConfigurationManager.GetSection ("system.web/machineKey");
    
    0 讨论(0)
提交回复
热议问题