473,382 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Access is denied - WINDOWS App!

I have been chasing what should be a simple problem for a day or two now. I
have done the google thing, but all the problems listed (at least so far)
have been problems with web applications.

My application is a WINDOWS app, and during the run I create a directory
called "CURRENT FLIGHT", and inside that directory I create several other
directories and files inside those. I update those files during the flight
phases. After the flight ends, I need to extract information from a XML file
in one of those sub-directories, create a new directory with our standard
name, and "move" all the directories and files from the current directory
into the new one. During shutdown this all works perfectly. HOWEVER, there
are events during the flights that I respond to, and one of those needs to do
the above process of creating a new directory, and move the files while in
flight, then continue processing. When I try this I get IO.Exception stating
"Access to the path <current flight directoryis denied". I created it, I
have been updating files in directories under it, but now I can't access it?
Hmmm....I am obviously missing something. Can anyone tell me what?

By the way I DO make sure all the files that I have been writing to inside
that directory are closed before I do any of this processing.

Thanks.
WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
Oct 25 '06 #1
6 1711
WhiteWizard wrote:
I have been chasing what should be a simple problem for a day or two now. I
have done the google thing, but all the problems listed (at least so far)
have been problems with web applications.
Can you post a short but complete program which demonstrates the
problem?

Jon

Oct 25 '06 #2
The program is pretty long, but here is the relevant code:

This is what I use to create the directories (modified):
public void CreateDirectories(EDSCommon.StayaliveClass tempStayaliveMessage)
{
if (Directory.Exists(rmmDriveLetter))
{
flightIdDir = rmmDriveLetter + "CURRENT FLIGHT";
rmmInitialized = true;
}
// Define the different directories on the RMM.
eventDir = flightIdDir + @"\Event Data";
engineDir = flightIdDir + @"\Engine Data";
engTrendDir = flightIdDir + @"\Trend Data";
lessTrendDir = flightIdDir + @"\LESS Data";
formsDir = flightIdDir + @"\Forms Data";

// If there is an RMM detected then create the directories on it.
if(rmmInitialized)
{
DirectoryInfo di = Directory.CreateDirectory(flightIdDir);
di = Directory.CreateDirectory(eventDir);
di = Directory.CreateDirectory(engineDir);
di = Directory.CreateDirectory(engTrendDir);
di = Directory.CreateDirectory(lessTrendDir);
di = Directory.CreateDirectory(formsDir);
}
}

Here is the code where the problem occurs. Note that this same method works
during shutdown, just not during the regular processing:

private void FinalizeRMMCurrentFlight()
{
if (rmmInitialized)
{
if (Directory.Exists(rmmDriveLetter + @"\Current Flight"))
{
try
{
DirectoryInfo di = new DirectoryInfo(rmmDriveLetter + @"\Current
Flight" + @"\Forms Data");
FileDirectoryIdInfo idInfo;
idInfo = GetFileDirectoryIdInfo(di);
string rmmTailNumber = idInfo.TailNumber;
DateTime rmmFlightDate = idInfo.TakeoffTime;

Directory.Move(rmmDriveLetter + @"\Current Flight",
rmmDriveLetter + rmmTailNumber
+ rmmFlightDate.Year.ToString("0#") +
rmmFlightDate.Month.ToString("0#")
+ rmmFlightDate.Day.ToString("0#") + "_" +
rmmFlightDate.Hour.ToString("0#")
+ rmmFlightDate.Minute.ToString("0#") +
rmmFlightDate.Second.ToString("0#") + "_1");
}
catch (FileNotFoundException exp)
{
/* What we have here is a failure to communicate - The FSR has
not been writen yet so can't be copied
so we just swallow this exception, continue processing, and
this directory will NOT be displayed
on the RMMCopyContol
*/
}
catch (Exception exp)
{
/* For testing only, not to be in production version */
MessageBox.Show(exp.ToString());
}
}
}
}

During the processing of the app, I update files in all of the
sub-directories, but I have a close method that closes all the files before I
go through the FinalizeRMM...method above.

HTH. Any thoughts?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Jon Skeet [C# MVP]" wrote:
WhiteWizard wrote:
I have been chasing what should be a simple problem for a day or two now. I
have done the google thing, but all the problems listed (at least so far)
have been problems with web applications.

Can you post a short but complete program which demonstrates the
problem?

Jon

Oct 25 '06 #3
PS

"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
The program is pretty long, but here is the relevant code:

This is what I use to create the directories (modified):
public void CreateDirectories(EDSCommon.StayaliveClass
tempStayaliveMessage)
{
if (Directory.Exists(rmmDriveLetter))
{
flightIdDir = rmmDriveLetter + "CURRENT FLIGHT";
Where is your \ seperator like you have in your Finalize method?

PS
rmmInitialized = true;
}
// Define the different directories on the RMM.
eventDir = flightIdDir + @"\Event Data";
engineDir = flightIdDir + @"\Engine Data";
engTrendDir = flightIdDir + @"\Trend Data";
lessTrendDir = flightIdDir + @"\LESS Data";
formsDir = flightIdDir + @"\Forms Data";

// If there is an RMM detected then create the directories on it.
if(rmmInitialized)
{
DirectoryInfo di = Directory.CreateDirectory(flightIdDir);
di = Directory.CreateDirectory(eventDir);
di = Directory.CreateDirectory(engineDir);
di = Directory.CreateDirectory(engTrendDir);
di = Directory.CreateDirectory(lessTrendDir);
di = Directory.CreateDirectory(formsDir);
}
}

Here is the code where the problem occurs. Note that this same method
works
during shutdown, just not during the regular processing:

private void FinalizeRMMCurrentFlight()
{
if (rmmInitialized)
{
if (Directory.Exists(rmmDriveLetter + @"\Current Flight"))
{
try
{
DirectoryInfo di = new DirectoryInfo(rmmDriveLetter +
@"\Current
Flight" + @"\Forms Data");
FileDirectoryIdInfo idInfo;
idInfo = GetFileDirectoryIdInfo(di);
string rmmTailNumber = idInfo.TailNumber;
DateTime rmmFlightDate = idInfo.TakeoffTime;

Directory.Move(rmmDriveLetter + @"\Current Flight",
rmmDriveLetter + rmmTailNumber
+ rmmFlightDate.Year.ToString("0#") +
rmmFlightDate.Month.ToString("0#")
+ rmmFlightDate.Day.ToString("0#") + "_" +
rmmFlightDate.Hour.ToString("0#")
+ rmmFlightDate.Minute.ToString("0#") +
rmmFlightDate.Second.ToString("0#") + "_1");
}
catch (FileNotFoundException exp)
{
/* What we have here is a failure to communicate - The FSR has
not been writen yet so can't be copied
so we just swallow this exception, continue processing, and
this directory will NOT be displayed
on the RMMCopyContol
*/
}
catch (Exception exp)
{
/* For testing only, not to be in production version */
MessageBox.Show(exp.ToString());
}
}
}
}

During the processing of the app, I update files in all of the
sub-directories, but I have a close method that closes all the files
before I
go through the FinalizeRMM...method above.

HTH. Any thoughts?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Jon Skeet [C# MVP]" wrote:
>WhiteWizard wrote:
I have been chasing what should be a simple problem for a day or two
now. I
have done the google thing, but all the problems listed (at least so
far)
have been problems with web applications.

Can you post a short but complete program which demonstrates the
problem?

Jon

Oct 25 '06 #4
WhiteWizard,

First off, Check the event viewer and see if there is a related
Error entry under applications. What you might find is that ASPNET
does not have write access to the directories in question. If not, and
there is an event log, then you have something to start with :-) Now,
since you are creating these directories, you might have to set
permissions on a Parent directory higher up that allows the account
under which your program is running to have full control and propagate
the changes to subdirectories. If this is a network share, then you
have to set these permissions on the share as well. goto directory
properties -sharing -permissions.

Oct 25 '06 #5
Good eye!

I tried changing that, thinking it might be that it was looking for the
wrong directory, but that had no effect. Actually had I thought about it,
the CURRENT FLIGHT directory was being created correctly AND is being
processed correctly during shutdown, but just not "in flight".

Thanks for the response though!

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"PS" wrote:
>
"WhiteWizard" <Wh*********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
The program is pretty long, but here is the relevant code:

This is what I use to create the directories (modified):
public void CreateDirectories(EDSCommon.StayaliveClass
tempStayaliveMessage)
{
if (Directory.Exists(rmmDriveLetter))
{
flightIdDir = rmmDriveLetter + "CURRENT FLIGHT";

Where is your \ seperator like you have in your Finalize method?

PS
rmmInitialized = true;
}
// Define the different directories on the RMM.
eventDir = flightIdDir + @"\Event Data";
engineDir = flightIdDir + @"\Engine Data";
engTrendDir = flightIdDir + @"\Trend Data";
lessTrendDir = flightIdDir + @"\LESS Data";
formsDir = flightIdDir + @"\Forms Data";

// If there is an RMM detected then create the directories on it.
if(rmmInitialized)
{
DirectoryInfo di = Directory.CreateDirectory(flightIdDir);
di = Directory.CreateDirectory(eventDir);
di = Directory.CreateDirectory(engineDir);
di = Directory.CreateDirectory(engTrendDir);
di = Directory.CreateDirectory(lessTrendDir);
di = Directory.CreateDirectory(formsDir);
}
}

Here is the code where the problem occurs. Note that this same method
works
during shutdown, just not during the regular processing:

private void FinalizeRMMCurrentFlight()
{
if (rmmInitialized)
{
if (Directory.Exists(rmmDriveLetter + @"\Current Flight"))
{
try
{
DirectoryInfo di = new DirectoryInfo(rmmDriveLetter +
@"\Current
Flight" + @"\Forms Data");
FileDirectoryIdInfo idInfo;
idInfo = GetFileDirectoryIdInfo(di);
string rmmTailNumber = idInfo.TailNumber;
DateTime rmmFlightDate = idInfo.TakeoffTime;

Directory.Move(rmmDriveLetter + @"\Current Flight",
rmmDriveLetter + rmmTailNumber
+ rmmFlightDate.Year.ToString("0#") +
rmmFlightDate.Month.ToString("0#")
+ rmmFlightDate.Day.ToString("0#") + "_" +
rmmFlightDate.Hour.ToString("0#")
+ rmmFlightDate.Minute.ToString("0#") +
rmmFlightDate.Second.ToString("0#") + "_1");
}
catch (FileNotFoundException exp)
{
/* What we have here is a failure to communicate - The FSR has
not been writen yet so can't be copied
so we just swallow this exception, continue processing, and
this directory will NOT be displayed
on the RMMCopyContol
*/
}
catch (Exception exp)
{
/* For testing only, not to be in production version */
MessageBox.Show(exp.ToString());
}
}
}
}

During the processing of the app, I update files in all of the
sub-directories, but I have a close method that closes all the files
before I
go through the FinalizeRMM...method above.

HTH. Any thoughts?

WhiteWizard
aka Gandalf
MCSD.NET, MCAD, MCT
"Jon Skeet [C# MVP]" wrote:
WhiteWizard wrote:
I have been chasing what should be a simple problem for a day or two
now. I
have done the google thing, but all the problems listed (at least so
far)
have been problems with web applications.

Can you post a short but complete program which demonstrates the
problem?

Jon


Oct 25 '06 #6
WhiteWizard <Wh*********@discussions.microsoft.comwrote:
The program is pretty long, but here is the relevant code:
What I'm after is something I can use to recreate the problem.

See http://www.pobox.com/~skeet/csharp/incomplete.html

I suspect that you may well find that while you're going through the
steps of coming up with such an example, you'll solve the issue.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 25 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Fabian von Romberg | last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000 PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a report using the webbrowser, I get the following...
3
by: Sachin_M | last post by:
Hi Friends, I want to develop a web based app where it will talk to a dll (which retrieves real time data from a controller) I've added a com dll reference to my project, the code is something...
12
by: Chad Crowder | last post by:
Hi all, I hope someone can give me a hand, because I'm out of ideas. I keep getting this message: Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET...
3
by: cjk | last post by:
Issue Our web application requires access to write to a custom event log, yet access is denied. This access is denied because we are using impersonation, and our end-users do not (should not) have...
11
by: James Goodman | last post by:
Ok, I had an ASP.NET application which after much trouble worked on a server, SERVER1. I need to move this application to another server, DC2. Both are domain controllers, both are running the...
2
by: Dave F. | last post by:
I just installed my ASP.NET app on a Win 2k server. I installed the files in a folder on D: and setup a virtual directory in IIS Default web. We had to install the Framework 1.1 and SP on this...
1
by: Rachel | last post by:
I have created a simple web service in VC# that adds two numbers. It returns an integer value to the client once invoked. I used Visual Studio .NET 2003, Windows XP Pro and .NET 1.1. I created a...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
0
by: Rico | last post by:
Helolo, I have an ASP.NET application on a Windows 2003 Server machine WITHOUT VS. I am working on an XPPro machine with VS 2003. I have installed the remote debugging components on the server....
1
by: JordanRieger | last post by:
Here is a nasty issue that has been giving me grief for the last couple days. This requires good knowledge of IIS, MSXML, and Windows/NTFS permissions. We have an existing ASP (VBScript) app...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.