Parimal Patel
Posts: 25
Joined: Wed Jun 01, 2016 3:16 am

How to set machineKey into Website Web.config

Thu Jun 16, 2016 6:53 am

Hi

My installer is deploying website to IIS. But i want to generate machine key or set the value into machinekey section of Website' web.config.
How can i configure this section under IIS section which generate key during installation.

Code: Select all

<machineKey decryptionKey="02B3539CECA90F4405983673BF7E776A5CE816EB092DA91A,IsolateApps" validationKey="64B58CDD8F173673A63E560A0F280365341DE81381FD247775D44F0C05D37B196379BCA943C5055C563B01B08199ED67FDA6B9D6C9D0998D02F52B8311F21B9E,IsolateApps" />
Thanks,

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: How to set machineKey into Website Web.config

Fri Jun 17, 2016 11:12 am

Hello,

Please give us some time to debate your request with our development team and we'll get back to you as soon as we have a clear response.

Thank you for your patience and understanding.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: How to set machineKey into Website Web.config

Tue Jun 21, 2016 10:17 am

Hello,

Thank you for your patience.

To achieve what you need you can use the "Custom Properties" tab from "IIS" page. Here are the steps to perform:
1. go to "IIS" page and select your web site; in the right pane select the "Custom Properties" tab
2. use the "New -> Attribute Value" context menu option and add two attributes like this:
  • Section: system.web/machineKey
    Name: decryptionKey
    Value: 02B3539CECA90F4405983673BF7E776A5CE816EB092DA91A,IsolateApps

    Section: system.web/machineKey
    Name: validationKey
    Value: 64B58CDD8F173673A63E560A0F280365341DE81381FD247775D44F0C05D37B196379BCA943C5055C563B01B08199ED67FDA6B9D6C9D0998D02F52B8311F21B9E,IsolateApps
3. rebuild and test the project

If you have any further questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Parimal Patel
Posts: 25
Joined: Wed Jun 01, 2016 3:16 am

Re: How to set machineKey into Website Web.config

Fri Jun 24, 2016 1:03 am

Thanks for reply

But The value of key should be changed on every single install or reinstall (e.g. like generate keys option in IIS under website). How can i achieve it?

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: How to set machineKey into Website Web.config

Fri Jun 24, 2016 12:11 pm

Hello,

I'm afraid I don't fully understand your last request. Do you want the related keys to be randomly generated each time the web site is installed?

Please give us more details (maybe exemplify a bit) about the behavior you want to attend.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Parimal Patel
Posts: 25
Joined: Wed Jun 01, 2016 3:16 am

Re: How to set machineKey into Website Web.config

Mon Jun 27, 2016 12:22 am

Yes, Key's Value should be randomly generated each time during the web site installation or Re-installation.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: How to set machineKey into Website Web.config

Mon Jun 27, 2016 12:43 pm

Hello,

I'm afraid we don't have support to generate the keys' value on each install/re-install. To achieve this you can create your own custom action which will generate random keys and will save them into two installer properties (DECRYPTION_PROP and VALIDATION_PROP). Then you can use the formatted reference of those properties (i.e. [DECRYPTION_PROP] and [VALIDATION_PROP]) in the Value fields from "IIS" page.

You can take a look on our "Create fully fledged C# custom actions" to learn how you can create and use a custom action.

Also, as a side note, can you share with us the reasons why you need those keys to be always explicitly generated and set during the installation project. Wouldn't be enough to set them as ​AutoGenerate, IsolateByAppId from the installation project?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Feature Requests”