473,320 Members | 1,828 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,320 software developers and data experts.

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 20373
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 #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¼¶¼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 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>
¼¶¼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 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¼¶¼g©ó¶l¥ó·s»D: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ˆu?l¢Dˆu¡Ps?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¢FD^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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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...
1
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...
2
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...
0
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...
0
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...
0
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...
5
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....
4
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...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.