Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 23rd, 2003, 03:05 AM
kaz kaz is offline
Authorized User
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default "Access is denied" error for opening documents

I tried to create the Open document method, but I got "Access is denied" error message. I checked the folder and files whether the security is executable, and it seems to be ok. Here is the code:

public void OpenDoc(string myDocumentsPath,

string fileName)


Process myProcess = new Process();



myProcess.StartInfo.FileName = myDocumentsPath + fileName;

myProcess.StartInfo.Verb = "Open";

myProcess.StartInfo.CreateNoWindow = true;

myProcess.StartInfo.UseShellExecute = false;

myProcess.StartInfo.RedirectStandardOutput = true;



catch (Win32Exception e)


if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)


Console.WriteLine(e.Message + ". Check the path.");


else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)


// Note that if your word processor might generate exceptions

// such as this, which are handled first.

Console.WriteLine(e.Message +

". You do not have permission to open this file.");



If you find something is wrong, please let me know.

Thank you for your help,

Old January 5th, 2004, 03:53 PM
MG MG is offline
Registered User
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Did you check to see that the ASPNET user account has rights to the file? If not then that is likely the culprit.


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Access Denied Error hkccwong Classic ASP Basics 6 January 11th, 2008 04:12 AM
'Access is denied' error purvin Javascript 4 March 22nd, 2006 04:42 AM
Opening a series of acrobat documents lshamba Classic ASP Basics 0 March 28th, 2005 12:34 AM
please.....urgent....."access denied error while s Ramakrishna General .NET 2 October 12th, 2004 12:19 AM
Chapter 3. Access Denied Error kevinq BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 30th, 2003 02:10 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.