469,575 Members | 1,193 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Process.Start throws Access Denied Win32Exception

I am using System.Diagnostics.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 19534
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级糶秎ン穝籇:1C**** ******************************@microsoft.com...
>I am using System.Diagnostics.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.Diagnostics.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级糶秎ン穝籇: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坲?l坲s?D:1C **********************************@microsoft.com.. .
>I am using System.Diagnostics.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.com.hkwrote in message
news:%2****************@TK2MSFTNGP05.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>
级糶秎ン穝籇: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^us?D:1C*************************** *******@microsoft.com...
I am using System.Diagnostics.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.com.hkwrote in message
news:%2****************@TK2MSFTNGP05.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.Diagnostics.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.com.hkwrote in message
news:%2****************@TK2MSFTNGP05.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.Diagnostics.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级糶秎ン穝籇:BA**** ******************************@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.com.hkwrote in message
news:%2****************@TK2MSFTNGP05.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坲?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.Diagnostics.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by adrian GREEMAN | last post: by
reply views Thread by Ron Weldy | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.