System.Diagnostics.Process.Start

G

Guest

Can any one help? I'm trying to use System.Diagnostics.Process.Start to open
legacy MS access aplications (ade and mdb files) and vb 6 .exe's using
asp.net. There is something confusing going on?!?
The files are all in the same network location, when I try and start the
MSaccess files I get a "file not found" error (it does go as far as opening
Msaccess, but doesn't load the DB), when I try to start the exe, the .exe is
found and runs, but the ini file is not found (you have to browse to it on
the local machine) then the SQL connection fails because its trying to log on
as the local machine name. All the files have inherited information from the
parent folder so are identical. This is the code I'm using:

Dim ProcessStartInfo As New System.Diagnostics.ProcessStartInfo
ProcessStartInfo.FileName = stb.ToString
ProcessStartInfo.WorkingDirectory = [local dir]
ProcessStartInfo.WindowStyle = ProcessStartInfo.WindowStyle.Maximized
ProcessStartInfo.UseShellExecute = True
ProcessStartInfo.CreateNoWindow = False
System.Diagnostics.Process.Start(ProcessStartInfo)

I've tried it with and without:

'Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
'Dim currentWindowsIdentity As
System.Security.Principal.WindowsIdentity
'currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
'impersonationContext = currentWindowsIdentity.Impersonate()

and my machine config is set up as this:

<identity impersonate="true" userName="domain\administrator"
password="password"/>
<processModel userName="machine" password="autogenerate" />

have also tried:

<processModel userName="system" password="autogenerate" />

Someone please help.....
 
C

Cor Ligthert

Toby,

Did you already try it this way.
(Typed here so watch typos)
\\\
Dim ProcessStartInfo As New Process
ProcessStartInfo.FileName = stb.ToString
ProcessStartInfo.WorkingDirectory = [local dir]
ProcessStartInfo.WindowStyle = WindowStyle.Maximized
Process.StartInfo.Arguments = "whatever"
ProcessStartInfo.UseShellExecute = True
ProcessStartInfo.CreateNoWindow = False
ProcessStartInfo.Start
///
I hope this helps?

Cor
 
G

Guest

Yep, have tried that. gives the same result :( The problem doesn't seem to be
with the vb code itself but the way asp authenticates.

Thanks, anyhow tho......
 
C

Cor Ligthert

Toby,

I did nowhere read in your question that this was in an ASP application. Is
it an ASP application? And when it is maybe can you than next time give that
information, can save a lot of time for the ones who want to help you.

Cor


toby said:
Yep, have tried that. gives the same result :( The problem doesn't seem to
be
with the vb code itself but the way asp authenticates.

Thanks, anyhow tho......

Cor Ligthert said:
Toby,

Did you already try it this way.
(Typed here so watch typos)
\\\
Dim ProcessStartInfo As New Process
ProcessStartInfo.FileName = stb.ToString
ProcessStartInfo.WorkingDirectory = [local dir]
ProcessStartInfo.WindowStyle = WindowStyle.Maximized
Process.StartInfo.Arguments = "whatever"
ProcessStartInfo.UseShellExecute = True
ProcessStartInfo.CreateNoWindow = False
ProcessStartInfo.Start
///
I hope this helps?

Cor
 
W

Willy Denoyette [MVP]

You can't do this (kind of).
When doing this from asp.net with userName="machine" or
userName="system", your exe will run as "aspnet" or "LOCALSYSTEM"
respectively (both are local accounts). In this case, the credentials used
on the network is the "machine account" .
If you run in a W2K Active Directory domain, you can grant access rights to
this machine account, else you have to set userName to a domain acount that
has access privileges to your DB.

Willy.
 
C

Cor Ligthert

Tobby,

I see now that I could have seen that you are using ASPNET because you are
using machine.config.

However maybe it is better when you tell that next time direct.

I do not assume that you want to start a windows UI application on the
server, while it is on the client AFAIK impossible (or should be impossible)

Cor


Cor Ligthert said:
I did nowhere read in your question that this was in an ASP application.
Is it an ASP application? And when it is maybe can you than next time give
that information, can save a lot of time for the ones who want to help
you.

Cor


toby said:
Yep, have tried that. gives the same result :( The problem doesn't seem
to be
with the vb code itself but the way asp authenticates.

Thanks, anyhow tho......

Cor Ligthert said:
Toby,

Did you already try it this way.
(Typed here so watch typos)
\\\
Dim ProcessStartInfo As New Process
ProcessStartInfo.FileName = stb.ToString
ProcessStartInfo.WorkingDirectory = [local dir]
ProcessStartInfo.WindowStyle = WindowStyle.Maximized
Process.StartInfo.Arguments = "whatever"
ProcessStartInfo.UseShellExecute = True
ProcessStartInfo.CreateNoWindow = False
ProcessStartInfo.Start
///
I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top