Reputation: 111
In a C# application, I'm creating a signature using DSACryptoServiceProvider. If the user executing the apllication has a temporary profile, I get an exception: CryptographicException: "The profile for the user is a temporary profile."
The failure can be solved if I set DSACryptoServiceProvider.UseMachineKeyStore = true; But I first want to check if this change is needed. For that, I want in my code to check of the user has a temporary profile.
How can I check that?
Upvotes: 11
Views: 4821
Reputation: 8628
The only information I have found on this issue seems to point at clickonce deployment.
There is seemingly no known workaround since you should be using a non temporary profile in order to make the calls you are making ...
Apparently you appear to have answered your own question look here ...
I want in my code to check of the user has a temporary profile.
How can I check that?
And the answer is ...
If the user executing the apllication has a temporary profile, I get an exception: CryptographicException: "The profile for the user is a temporary profile."
Seems fairly straightforward, if you get that error you need to execute using a different profile. You could have a test method that executes this code as a check before running through your actual code.
I have heard of one other option though, assuming this is within the context of an asp.net application you should be able to get the current profile like this ...
ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
From there you should be able to query the profile instance, i believe its a type of ProfileBase documented here ...
http://msdn.microsoft.com/en-us/library/ms151820(v=VS.100).aspx
Hope this helps clear things up a bit for you.
Upvotes: 2