Asp.net Mvc Machine Key Generator

Posted on  by 

Machine key generating closed. Machine Key Generator. How to delete old cookies after changing to manual machine key and wildcard cookies ASP.NET MVC 4.5. Sep 05, 2006 Download Machine Key Generator. The Element configures keys to use for encryption and decryption of forms authentication cookie data and viewstate data, and for verification of out-of-process session state identification. May 13, 2009 The machineKey element of the ASP.NET web.config specifies the algorithm and keys that ASP.NET will use for encryption. By default the validationKey and the decryptionKey keys are set to AutoGenerate which means the runtime will generate a random key for use. This works fine for applications that are deployed on a single server.

5 Sep 2006
This module is a simple windows application that generates machine keys for web farm

Introduction

The <machineKey> Element configures keys to use for encryption and decryption of forms authentication cookie data and viewstate data, and for verification of out-of-process session state identification. This section can be declared at the machine, site, and application levels, but not at the subdirectory level. Using this pattern allows your application to save your authentication ticket, in away that you can travel around different websites that have the same machine key using this ticket.

Machine Key

Machine key comes in the following format:

The Code

<o:p>

And to generate some random data using RNG (Random Number Generator)

Finally, we need to convert random generated data into hexadecimal:

Key-->

Have you ever needed to generate a MachineKey to use in your application's configuration file or in machine.config? You may need a MachineKey in several scenarios. One of them is the scenario where you deploy your application in a web farm. One another scenario is to need to encrypt Forms Authentication tickets.

You have some options to generate a MachineKey:

  • You can build the sample application from the following article: http://support.microsoft.com/kb/312906
  • You can search in Bing for 'MachineKey generator' and use an online service. Honestly I wouldn't rely on third party online services for generating MachineKey because I wouldn't have any control over them and I couldn't make sure that if they wouldn't log my IP address and MachineKey in a database to use that later - yes, I know it sounds like 'paranoia' :)

There is one another way which I have learned from one of my customers today. It was over there waiting in IIS user interface but I never gave it a try before (shame on me). You can use IIS 7.5 user interface to generate the MachineKey section and save it in the web.config of your application / root web.config file. Steps are quite easy:

1) Open IIS manager.

2) If you need to generate and save the MachineKey for all your applications select the server name in the left pane, in that case you will be modifying the root web.config file (which is placed in the .NET framework folder). If your intention is to create MachineKey for a specific web site/application then select the web site / application from the left pane. In that case you will be modifying the web.config file of your application.

Asp Mvc Tutorial

3) Double click the Machine Key icon in ASP.NET settings in the middle pane:

4) MachineKey section will be read from your configuration file and be shown in the UI. If you did not configure a specific MachineKey and it is generated automatically you will see the following options:

Asp.net Mvc Machine Key Generator Reviews

5) Now you can click Generate Keys on the right pane to generate random MachineKeys. When you click Apply, all settings will be saved in the web.config file.

Machine Key Stock

--
AMB

Coments are closed