Click here to Skip to main content
15,912,329 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using combobox from Form1 Pin
saqib8218-Sep-06 0:24
saqib8218-Sep-06 0:24 
Questiona question about arrays in C# Pin
Green Fuze17-Sep-06 23:36
Green Fuze17-Sep-06 23:36 
AnswerRe: a question about arrays in C# Pin
Colin Angus Mackay17-Sep-06 23:43
Colin Angus Mackay17-Sep-06 23:43 
AnswerRe: a question about arrays in C# Pin
S. Senthil Kumar18-Sep-06 3:13
S. Senthil Kumar18-Sep-06 3:13 
GeneralRe: a question about arrays in C# Pin
Green Fuze18-Sep-06 8:26
Green Fuze18-Sep-06 8:26 
AnswerRe: a question about arrays in C# Pin
WillemM18-Sep-06 3:25
WillemM18-Sep-06 3:25 
GeneralRe: a question about arrays in C# Pin
Green Fuze18-Sep-06 8:26
Green Fuze18-Sep-06 8:26 
QuestionIs this a bug - RSA Session Files & DirectoryInfo [modified] Pin
MrEyes17-Sep-06 23:36
MrEyes17-Sep-06 23:36 
I have come across something that I can only describe as the strangest bug I have ever encountered whilst working with the .NET Framework.

I have the following code:

static void Main(string[] args)
{
	string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
	string rsaSessionPath = @"Microsoft\Crypto\RSA\S-1-5-18\";
	string fullPath = Path.Combine(localAppDataPath, rsaSessionPath);

	DirectoryInfo di = new DirectoryInfo(fullPath);

	FileInfo[] rsaSessionFiles = di.GetFiles();

	foreach (FileInfo rsaSessionFile in rsaSessionFiles)
	{
		if (rsaSessionFile.CreationTime < DateTime.Now.AddDays(-3))
		{
			rsaSessionFile.Delete();
		}
	}

}


As you can see this is a very simple piece of code that retrieves all files within a specific directory and then deletes all the files aged 3 days old and over.

Now this application works exactly as I would expect it to, however I have found an interesting side effect of execution.

The server this application runs on, has various user with varying degrees of permissions. One of these user accounts (with admin privs) is used to execute various windows scheduled tasks. When I execute the application, the user on the scheduled task changes to the Administrator account, however the password is left as the password for the original account. Therefore the scheduled task fails.

I have tested this to death and cannot find another reason, everything points to the application code above. However as you can see it doesnt go anywhere near scheduled tasks so I am at a loss to explain this.

In a crazy turn of logic I also checked that the scheduler doesnt store any information in the directory the application clears out, and this is the case. Even with the delete directory emtpy, the same problem occurs.

Can anybody shed any light on this?


-- modified at 5:41 Monday 18th September, 2006

Interestingly, I have also created another new administrator account and logged on with this, when I run the application the user on the scheduled task changes to the new account name. So it seems that it changes to whoever is logged on and executes the application
QuestionRunning/Launching MsBuild Pin
kulile17-Sep-06 23:34
kulile17-Sep-06 23:34 
QuestionRunning MsBuild Pin
kulile17-Sep-06 23:30
kulile17-Sep-06 23:30 
QuestionPopulating a datagrid Pin
subduction3617-Sep-06 23:05
subduction3617-Sep-06 23:05 
AnswerRe: Populating a datagrid Pin
Tamimi - Code17-Sep-06 23:43
Tamimi - Code17-Sep-06 23:43 
GeneralRe: Populating a datagrid Pin
subduction3618-Sep-06 0:06
subduction3618-Sep-06 0:06 
GeneralRe: Populating a datagrid Pin
Tamimi - Code18-Sep-06 0:44
Tamimi - Code18-Sep-06 0:44 
GeneralRe: Populating a datagrid Pin
llap44418-Sep-06 3:14
llap44418-Sep-06 3:14 
GeneralRe: Populating a datagrid Pin
llap44418-Sep-06 3:21
llap44418-Sep-06 3:21 
QuestionHow to create a EAN-13 barcode checking? Pin
llyod17-Sep-06 22:59
llyod17-Sep-06 22:59 
AnswerRe: How to create a EAN-13 barcode checking? Pin
Stefan Troschuetz17-Sep-06 23:12
Stefan Troschuetz17-Sep-06 23:12 
AnswerRe: How to create a EAN-13 barcode checking? Pin
Hamid_RT18-Sep-06 9:32
Hamid_RT18-Sep-06 9:32 
QuestionHow to create windows service in C# Pin
Rajesh_K_Sharma17-Sep-06 22:38
Rajesh_K_Sharma17-Sep-06 22:38 
QuestionHow could i set at which second the sound play? Pin
Nafiseh Salmani17-Sep-06 22:24
Nafiseh Salmani17-Sep-06 22:24 
AnswerRe: How could i set at which second the sound play? Pin
Nafiseh Salmani19-Sep-06 2:58
Nafiseh Salmani19-Sep-06 2:58 
QuestionShowing the log file to user Pin
saqib8217-Sep-06 21:41
saqib8217-Sep-06 21:41 
AnswerRe: Showing the log file to user Pin
Stefan Troschuetz17-Sep-06 23:15
Stefan Troschuetz17-Sep-06 23:15 
Questionhow can i save utf-8 format characters to sql database/ Encode or Decode Pin
sikandarhayat17-Sep-06 21:37
sikandarhayat17-Sep-06 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.