I have a machine key "Autogenerate,IsolateApps", and I want some tool/code to create a new Autogenerated machine key in a transparent way, without knowing what the key is, and more important WITHOUT the need to insert it in my web.config...
I think that the Autogeneration can launch the creation af a new key under some conditions, I would like to know what are those conditions...
hans_v, how did you know that?! I've been looking all over for when the machine key gets auto generated and couldn't find that answer. Maybe I was asking the wrong question? Anyways, I'd love to know your source. Please share!
hans_v, how did you know that?! I've been looking all over for when the machine key gets auto generated and couldn't find that answer.
According to MSDN, when using the default settings, this shouldn't happen. But after many problems (unexpected logouts on irregular intervals, validation of viewstate mac failed errors) on different shared hosted environments, I starred to log all the applicatiomn
starts, and I noticed that when the problems occured, the application was also restarted. The common source I noticed was the machinekey, which is used to encrypt both the ViewState and the Authentication. Since then, I always use a Machine Key, and never
ever had any problems like this anymore....
webch
Member
2 Points
2 Posts
Forcing a machine key regeneration
Feb 06, 2012 02:32 PM|LINK
Hello,
I'm trying to force a machine key to regenerate, since it's configured as follow:
AutoGenerate,IsolateApps
but I don't know which event can start a new (automatic) generation
of a new machine key...
Some hint?
hikoo_m
Member
568 Points
113 Posts
Re: Forcing a machine key regeneration
Feb 08, 2012 07:57 AM|LINK
In c# to generate a machine key
http://www.blackbeltcoder.com/Articles/asp/generating-a-machinekey-element
Macro to Generate Machine Keys
http://weblogs.asp.net/dfindley/archive/2007/02/05/a-vs-net-macro-to-generate-machine-keys.aspx
webch
Member
2 Points
2 Posts
Re: Forcing a machine key regeneration
Feb 08, 2012 12:53 PM|LINK
I'm sorry but I have a different purpose:
I have a machine key "Autogenerate,IsolateApps", and I want some tool/code to create a new Autogenerated machine key in a transparent way, without knowing what the key is, and more important WITHOUT the need to insert it in my web.config...
I think that the Autogeneration can launch the creation af a new key under some conditions, I would like to know what are those conditions...
Thanks in advance
hans_v
All-Star
35986 Points
6550 Posts
Re: Forcing a machine key regeneration
Feb 08, 2012 09:49 PM|LINK
A new key is generated when the application pool recycles. You can force an application pool restart by calling HttpRuntime.UnloadAppDomain
BSayatovic
Member
2 Points
1 Post
Re: Forcing a machine key regeneration
Aug 03, 2012 08:06 PM|LINK
hans_v, how did you know that?! I've been looking all over for when the machine key gets auto generated and couldn't find that answer. Maybe I was asking the wrong question? Anyways, I'd love to know your source. Please share!
hans_v
All-Star
35986 Points
6550 Posts
Re: Forcing a machine key regeneration
Aug 05, 2012 12:10 AM|LINK
According to MSDN, when using the default settings, this shouldn't happen. But after many problems (unexpected logouts on irregular intervals, validation of viewstate mac failed errors) on different shared hosted environments, I starred to log all the applicatiomn starts, and I noticed that when the problems occured, the application was also restarted. The common source I noticed was the machinekey, which is used to encrypt both the ViewState and the Authentication. Since then, I always use a Machine Key, and never ever had any problems like this anymore....