Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know if the profile for the user executing an application is a temporary profile?

Tags:

c#

.net

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?

like image 249
arieltk Avatar asked Mar 07 '10 08:03

arieltk


People also ask

How can you tell if a profile is temporary?

Right click 'My Computer', goto 'Properties' then on the Advanced tab click [Settings] under User Profiles. This will list all the user profiles on the PC, sizes, date modified etc. Verify you don't have two with similar names or one local and the one you want to use being a roaming profile.

What is a temporary user profile?

A temporary user profile is issued each time an error condition prevents the user's profile from loading. Temporary profiles are deleted at the end of each session, and changes made by the user to their desktop settings and files are lost when the user logs off.

Why is my Microsoft profile temporary?

Sometimes if the User account gets corrupted and cannot start, Windows will sign into a temporary account. A Temp Account cannot be used as a normal account so do not set it up or copy files into it because at any restart it might decide to start into your old Account.


1 Answers

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.

like image 188
War Avatar answered Oct 02 '22 12:10

War