I have developed a web app using DPAPI to encrypt a
connection string in the web.config file. The application
works perfectly on the development machine but when
deployed to the server when opening the app the following
wrror is generated:
Exception decrypting. Decryption failed. Key not valid for
use in specified state.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.
Exception Details: System.Exception: Exception decrypting.
Decryption failed. Key not valid for use in specified
state.
Source Error:
An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.
Stack Trace:
[Exception: Exception decrypting. Decryption failed. Key
not valid for use in specified state.
]
DataProtection.DataProtector.Decrypt(Byte[] cipherText,
Byte[] optionalEntropy)
StatusTrack.welcomeForm.GetConnectionString() +130
StatusTrack.welcomeForm.CreateDataSource() +19
StatusTrack.welcomeForm.FillGrid() +665
StatusTrack.welcomeForm.Page_Load(Object sender,
EventArgs e) +170
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Does anyone have an answer for this?
Thanks,
Dave