Peter,
As i read the question, the exception is thrown when the RijndaelManaged
class is instatiated. This tells me that some registry key is accesed
during
this process. Which?
I don't know. The OP didn't post a concise-but-complete example of code
that would consistently reproduce the problem, so it's not even possible
to say in this case unless you have specific knowledge of the workings of
that class. I don't.
However, someone debugging the code when the exception happens ought to be
able to.
And if the RijndaelManaged class requieres acces to som
registry key when instantiating, how do you fix your program so it does
not requeire acces to that key?
Again, I don't know. Without knowing what the OP is doing that would
cause instantiating the object to try that registry access, it's not
possible for me to answer that question. There's only one constructor for
the RijndaelManaged class, and using it does not by default cause a
security-restricted registry access.
If the class requires that access, then the only fix is to either provide
a way for the user to elevate their privileges, or stop using the class in
a way that causes that attempt to access the registry (or stop using it
altogether, though presumably that's not a very good solution).
So, I'm still left wondering what sort of help the OP expects. No code
was posted, no suggestion as to why they are in this situation in the
first place. They *do* get an exception, and my experience has been that
when the code actually *stops* (exception, null reference, etc) it's
fairly easy to look at the current state of the program and figure out
what is wrong. But only the OP can do that.
Pete