473,761 Members | 3,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process.Start throws Access Denied Win32Exception

I am using System.Diagnost ics.Process class to open a word document by call
ing Process.Start(" test.doc"). I am using C# as programming language. On some
of the computers on running this code i get "Access is Denied"
Win32Exception. What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay
Mar 15 '07 #1
7 20439
Either the user do not have right to access the "test.doc", or does not have
right to start MSWord or whatever assigned to open the "test.doc" (like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com¼ ¶¼g©ó¶l¥ó·s»D:1 C************** *************** *****@microsoft .com...
>I am using System.Diagnost ics.Process class to open a word document by call
ing Process.Start(" test.doc"). I am using C# as programming language. On
some
of the computers on running this code i get "Access is Denied"
Win32Exception. What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay

Mar 15 '07 #2
Thanks Lau,
That is the first thing i did was to check the permissions and
really the permissions are the same, and to confirm the problem
was not related to permissions, I even logged in as a Administrator
and ran the application.

Basically, I am trying to export data to word document, for which i am
taking the following steps.

I have a richtextbox which shows data to user, as and when the user
is happy with the data, he clicks export, so a save as file dialog pops
up and user can give a name to the file and store it where he wants.
Now after he clicks save, and the control returns to our program,
i fire the Process.Start(" filename") which the user had assigned.
Now i dont get why this works on 5 / 6 machines and fails only on the
one laptop ! i have checked permisions of each and every folder possible.

Hope this explains my problem, and if possible u might have an idea to solve
it
Thanks,
Jay

"Lau Lei Cheong" wrote:
Either the user do not have right to access the "test.doc", or does not have
right to start MSWord or whatever assigned to open the "test.doc" (like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com ¼Â¶Â¼g©ó¶lÂ¥ ó·s»D:1C**** *************** *************** @microsoft.com. ..
I am using System.Diagnost ics.Process class to open a word document by call
ing Process.Start(" test.doc"). I am using C# as programming language. On
some
of the computers on running this code i get "Access is Denied"
Win32Exception. What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay


Mar 15 '07 #3
Could it be because the file is not completely saved when you run
Process.Start() ?

See if it helps to run a loop on File.Open() on the path until it returns a
handle, close the FileStream and use Process.Start() to open it.

Or it'd be neater if just Thread.Sleep() for 2 seconds in between...

"jk" <jk@discussions .microsoft.com¼ ¶¼g©ó¶l¥ó·s»D:2 B************** *************** *****@microsoft .com...
Thanks Lau,
That is the first thing i did was to check the permissions and
really the permissions are the same, and to confirm the problem
was not related to permissions, I even logged in as a Administrator
and ran the application.

Basically, I am trying to export data to word document, for which i am
taking the following steps.

I have a richtextbox which shows data to user, as and when the user
is happy with the data, he clicks export, so a save as file dialog pops
up and user can give a name to the file and store it where he wants.
Now after he clicks save, and the control returns to our program,
i fire the Process.Start(" filename") which the user had assigned.
Now i dont get why this works on 5 / 6 machines and fails only on the
one laptop ! i have checked permisions of each and every folder possible.

Hope this explains my problem, and if possible u might have an idea to
solve
it
Thanks,
Jay

"Lau Lei Cheong" wrote:
>Either the user do not have right to access the "test.doc", or does not
have
right to start MSWord or whatever assigned to open the "test.doc" (like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com? ??gcˆu?l¢Dˆu¡Ps ?D:1C********** *************** *********@micro soft.com...
>I am using System.Diagnost ics.Process class to open a word document by
call
ing Process.Start(" test.doc"). I am using C# as programming language.
On
some
of the computers on running this code i get "Access is Denied"
Win32Exception. What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay



Mar 15 '07 #4
VJ
Try using reflection to open word objects or any Microsoft office
application. Eliminates all these process / file lock issues ( will not
security issues )

http://groups.google.com/group/micro...0fd079831c401b

The link can get you started.. If you have furthers question on this method
please ask!

VJ

"Lau Lei Cheong" <le****@yehoo.c om.hkwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Could it be because the file is not completely saved when you run
Process.Start() ?

See if it helps to run a loop on File.Open() on the path until it returns
a handle, close the FileStream and use Process.Start() to open it.

Or it'd be neater if just Thread.Sleep() for 2 seconds in between...

"jk" <jk@discussions .microsoft.com>
¼¶¼g©ó¶l¥ó·s»D: 2B************* *************** ******@microsof t.com...
>Thanks Lau,
That is the first thing i did was to check the permissions and
really the permissions are the same, and to confirm the problem
was not related to permissions, I even logged in as a Administrator
and ran the application.

Basically, I am trying to export data to word document, for which i am
taking the following steps.

I have a richtextbox which shows data to user, as and when the user
is happy with the data, he clicks export, so a save as file dialog pops
up and user can give a name to the file and store it where he wants.
Now after he clicks save, and the control returns to our program,
i fire the Process.Start(" filename") which the user had assigned.
Now i dont get why this works on 5 / 6 machines and fails only on the
one laptop ! i have checked permisions of each and every folder possible.

Hope this explains my problem, and if possible u might have an idea to
solve
it
Thanks,
Jay

"Lau Lei Cheong" wrote:
>>Either the user do not have right to access the "test.doc", or does not
have
right to start MSWord or whatever assigned to open the "test.doc" (like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com>
???gc^u?l¢D^u ¡Ps?D:1C******* *************** ************@mi crosoft.com...
I am using System.Diagnost ics.Process class to open a word document by
call
ing Process.Start(" test.doc"). I am using C# as programming language.
On
some
of the computers on running this code i get "Access is Denied"
Win32Exception . What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay


Mar 15 '07 #5
Thanks for your reply Lau and VJ,

Reflection i think would be too heavy duty to just open a
word file, but may be give it a go and see.

Still have not found a solution for this problem,
but will post it whenever i have any.

Let me know if u guys have any other ideas on the same,

thanks

jay

"VJ" wrote:
Try using reflection to open word objects or any Microsoft office
application. Eliminates all these process / file lock issues ( will not
security issues )

http://groups.google.com/group/micro...0fd079831c401b

The link can get you started.. If you have furthers question on this method
please ask!

VJ

"Lau Lei Cheong" <le****@yehoo.c om.hkwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Could it be because the file is not completely saved when you run
Process.Start() ?

See if it helps to run a loop on File.Open() on the path until it returns
a handle, close the FileStream and use Process.Start() to open it.

Or it'd be neater if just Thread.Sleep() for 2 seconds in between...

"jk" <jk@discussions .microsoft.com>
¼¶¼g©ó¶l ¥Ã³Â·s»D:2B*** *************** *************** *@microsoft.com ...
Thanks Lau,
That is the first thing i did was to check the permissions and
really the permissions are the same, and to confirm the problem
was not related to permissions, I even logged in as a Administrator
and ran the application.

Basically, I am trying to export data to word document, for which i am
taking the following steps.

I have a richtextbox which shows data to user, as and when the user
is happy with the data, he clicks export, so a save as file dialog pops
up and user can give a name to the file and store it where he wants.
Now after he clicks save, and the control returns to our program,
i fire the Process.Start(" filename") which the user had assigned.
Now i dont get why this works on 5 / 6 machines and fails only on the
one laptop ! i have checked permisions of each and every folder possible.

Hope this explains my problem, and if possible u might have an idea to
solve
it
Thanks,
Jay

"Lau Lei Cheong" wrote:

Either the user do not have right to access the "test.doc", or does not
have
right to start MSWord or whatever assigned to open the "test.doc" (like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com>
???gc^u?l¢D^u ¡Ps?D:1C****** *************** *************@m icrosoft.com...
I am using System.Diagnost ics.Process class to open a word document by
call
ing Process.Start(" test.doc"). I am using C# as programming language.
On
some
of the computers on running this code i get "Access is Denied"
Win32Exception. What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay


Mar 16 '07 #6

Hi,
I think i have much better explanation of the same problem in this post:
http://msdn.microsoft.com/newsgroups...b066668cf7&p=1

Thanks,

Jay
"jk" wrote:
Thanks for your reply Lau and VJ,

Reflection i think would be too heavy duty to just open a
word file, but may be give it a go and see.

Still have not found a solution for this problem,
but will post it whenever i have any.

Let me know if u guys have any other ideas on the same,

thanks

jay

"VJ" wrote:
Try using reflection to open word objects or any Microsoft office
application. Eliminates all these process / file lock issues ( will not
security issues )

http://groups.google.com/group/micro...0fd079831c401b

The link can get you started.. If you have furthers question on this method
please ask!

VJ

"Lau Lei Cheong" <le****@yehoo.c om.hkwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Could it be because the file is not completely saved when you run
Process.Start() ?
>
See if it helps to run a loop on File.Open() on the path until it returns
a handle, close the FileStream and use Process.Start() to open it.
>
Or it'd be neater if just Thread.Sleep() for 2 seconds in between...
>
"jk" <jk@discussions .microsoft.com>
¼¶¼g©ó¶l ¥Ã³Â·s»D:2B*** *************** *************** *@microsoft.com ...
>Thanks Lau,
>That is the first thing i did was to check the permissions and
>really the permissions are the same, and to confirm the problem
>was not related to permissions, I even logged in as a Administrator
>and ran the application.
>>
>Basically, I am trying to export data to word document, for which i am
>taking the following steps.
>>
>I have a richtextbox which shows data to user, as and when the user
>is happy with the data, he clicks export, so a save as file dialog pops
>up and user can give a name to the file and store it where he wants.
>Now after he clicks save, and the control returns to our program,
>i fire the Process.Start(" filename") which the user had assigned.
>Now i dont get why this works on 5 / 6 machines and fails only on the
>one laptop ! i have checked permisions of each and every folder possible.
>>
>Hope this explains my problem, and if possible u might have an idea to
>solve
>it
>Thanks,
>Jay
>>
>"Lau Lei Cheong" wrote:
>>
>>Either the user do not have right to access the "test.doc", or does not
>>have
>>right to start MSWord or whatever assigned to open the "test.doc" (like
>>WordPad).
>>>
>>Go check whether they can open the file directly first.
>>>
>>"jk" <jk@discussions .microsoft.com>
>>???gc^u?l¢D^ u¡Ps?D:1C***** *************** **************@ microsoft.com.. .
>>I am using System.Diagnost ics.Process class to open a word document by
>>call
>ing Process.Start(" test.doc"). I am using C# as programming language.
>On
>some
>of the computers on running this code i get "Access is Denied"
>Win32Exception . What do i do to not generate this exception ?
>>
>Any help highly appreciated,
>>
>Thanks,
>>
>Jay
>>>
>>>
>>>
>
>
Mar 16 '07 #7
Strange... it yet looks like a permission problem.(ACL while file copy
follows its parent.)

Would you mind to run "cacls test.doc" on the "Program Files" folder and
paste the output here?

Feel free to mask out the account names, but just let us know which one is
the account your application is running on.

"jk" <jk@discussions .microsoft.com¼ ¶¼g©ó¶l¥ó·s»D:B A************** *************** *****@microsoft .com...
>
Hi,
I think i have much better explanation of the same problem in this post:
http://msdn.microsoft.com/newsgroups...b066668cf7&p=1

Thanks,

Jay
"jk" wrote:
>Thanks for your reply Lau and VJ,

Reflection i think would be too heavy duty to just open a
word file, but may be give it a go and see.

Still have not found a solution for this problem,
but will post it whenever i have any.

Let me know if u guys have any other ideas on the same,

thanks

jay

"VJ" wrote:
Try using reflection to open word objects or any Microsoft office
application. Eliminates all these process / file lock issues ( will not
security issues )

http://groups.google.com/group/micro...0fd079831c401b

The link can get you started.. If you have furthers question on this
method
please ask!

VJ

"Lau Lei Cheong" <le****@yehoo.c om.hkwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Could it be because the file is not completely saved when you run
Process.Start() ?

See if it helps to run a loop on File.Open() on the path until it
returns
a handle, close the FileStream and use Process.Start() to open it.

Or it'd be neater if just Thread.Sleep() for 2 seconds in between...

"jk" <jk@discussions .microsoft.com>
???gcˆu?l¢Dˆu¡P s?D:2B********* *************** **********@micr osoft.com...

Thanks Lau,
That is the first thing i did was to check the permissions and
really the permissions are the same, and to confirm the problem
was not related to permissions, I even logged in as a Administrator
and ran the application.

Basically, I am trying to export data to word document, for which i
am
taking the following steps.

I have a richtextbox which shows data to user, as and when the user
is happy with the data, he clicks export, so a save as file dialog
pops
up and user can give a name to the file and store it where he wants.
Now after he clicks save, and the control returns to our program,
i fire the Process.Start(" filename") which the user had assigned.
Now i dont get why this works on 5 / 6 machines and fails only on
the
one laptop ! i have checked permisions of each and every folder
possible.

Hope this explains my problem, and if possible u might have an idea
to
solve
it
Thanks,
Jay

"Lau Lei Cheong" wrote:

Either the user do not have right to access the "test.doc", or does
not
have
right to start MSWord or whatever assigned to open the "test.doc"
(like
WordPad).

Go check whether they can open the file directly first.

"jk" <jk@discussions .microsoft.com>
???gc^u?l¢FD^ u!Ps?D:1C****** *************** *************@m icrosoft.com...
I am using System.Diagnost ics.Process class to open a word
document by
call
ing Process.Start(" test.doc"). I am using C# as programming
language.
On
some
of the computers on running this code i get "Access is Denied"
Win32Exception . What do i do to not generate this exception ?

Any help highly appreciated,

Thanks,

Jay




Mar 16 '07 #8

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

Similar topics

0
2073
by: adrian GREEMAN | last post by:
I am fairly much a beginner and have probably done something wrong but version 4.0.12 will not let me in. I have been using MySQL (via MySQL Front and PHPMyAdmin as interfaces usually) on a Windows ME PC with Apache, all just for learning databases, SQL and PHP. I learn slowly since I have to do a lot of other things but it has gone reasonable well. As part exercise and part for use I have been building a small
1
3703
by: Ron | last post by:
I have a asp.net application that uses the above class to open, get status and start/stop a service. I can get the Status of my Service, but can't start/stop it. I keep getting Access Denied errors. System.ComponentModel.Win32Exception: Access is denied I see ServiceControllerPermission class - but not sure how to use it.
2
18056
by: Cédric Rossé | last post by:
Hello, I'm currently developping a web application and I'm trying to execute a batch file (.cmd) on the server side when the client presses a button on a web page. When I do this on my local machine (where I'm developping my application), no problem occurs. But when I put the web application on my Windows server 2003 server, I always get the following error message. Can someone help me ? Here is the config of my webconfig file :
0
1280
by: Ron Weldy | last post by:
I've looked at just about everything at this point, and I'm still getting the "Error while trying to run project: Unable to start debugging on the web server. Access is denied." message when trying to debug on my remote server. I am an administrator and I have added ASPNET to the the Debugger Users... so I don't get it. Using Windows server 2003 and I have active directory set up (unfortunately I was messing with MS CRM and that requires...
0
1981
by: kk | last post by:
hello all, I want to call an exe(IISWeb.vbs) to create a site in Sharepoint.While calling that exe through Process.Start() it throws the following exception. 1.while calling through webService ,it throws the exception "ACCESS DENIED". 2.While calling through console Application,it throws
0
6741
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course (1.1 does not support running a process as a different user). I'm running everything on Windows Server 2003. I have impersonation enabled in my web.config, and I'm using Integrated authentication on the IIS virtual directory that this aspx is in....
5
2636
by: Vijaya P Krishna | last post by:
Hi, I have a .NET Windows Forms application, written in VB.NET and C#. I am opening a URL from the application using Process.Start(). The URL points to a java servlet running on apache-tomcat. For some users the application shows an error dialog with following information. Another very interesting observation is that it's sending a lot of requests to the servlet within no time. Please note that this is not happening for all users.
4
21749
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
1
1825
by: Rick | last post by:
I've migrated a web site from VS 2003 to VS 2005. After pushing the a Windows Server 2003 web server. The Framework 2.0 web site works when I go to test it. I'll start working on something else come back later and I start getting Access Denied errors on System.Data or System.Transaction, these files are set up as assemblies in the machine.config and set to the correct version. The only way to fix it is to restart ASP.NET. Any suggestions?
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.