473,320 Members | 2,109 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.

Run process as different user hangs

I am attempting to launch an executable from an ASP.NET site using the
following code:
----------
ProcessStartInfo psi = new ProcessStartInfo(sforcePath);
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = System.IO.Path.GetDirectoryName(sforcePath);

string pwd = "password";
char[] pwdchars = pwd.ToCharArray();
SecureString spwd = new SecureString();
for(int i=0;i<pwdchars.Length;i++)
spwd.AppendChar(pwdchars[i]);

psi.UserName = "user";
psi.Password = spwd;

string[] args = new string[8];
args[0] = dbServer;
args[1] = dbTable;
args[2] = dbUser;
args[3] = dbPass;
args[4] = sForceLogFilePath;
args[5] = sForceUser;
args[6] = sForcePass;
args[7] = sForceLookupPeriod;
string totalArgStr = "";
foreach (string tStr in args)
totalArgStr += tStr + " ";

psi.Arguments = totalArgStr;

Process p = new Process();
p.StartInfo = psi;
p.Start();
p.WaitForExit();
----------

But the process hangs - the web page doesn't resume until I kill the process
using task manager. Obviously, I'd much rather the program execute and
terminate on it's own :). I've read several postings describing this
behavior, but have not seen any posts that have successfully overcome this
issue. Any help is greatly appreciated.
Jun 16 '06 #1
0 1225

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

Similar topics

4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
3
by: JTF | last post by:
Whenever I start an application from ASP.NET, the exe hangs, with Task manager showing no cpu time. Every exe I've tried hangs in the same way (notepad, cmd, ms access). What runs is a .net exe...
1
by: Scott | last post by:
I am trying to write an asp.net web page that will spawn a third party .exe file and return the results back to my asp page. I am able to write a vb.net program that will do this just fine. I...
4
by: Jesse Cates via DotNetMonster.com | last post by:
I am trying to launch a command-line program that came with a program called Live Stats. This command-line program is used to automate configuration of Live Stats. In order to test this, I am just...
5
by: Paul Bergson | last post by:
I have been trying to get a process to start up and run with arguments passed to it. I have gotten close (Thanks to help from this board) but I there is a failure while I'm running this because...
11
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any...
6
by: Alexander Widera | last post by:
hello, if i start a program (an exe-file) with Process.Start(...) I don't have the required permissions that the programm needs (i could start the programm but the program needs special rights)....
5
by: Saya | last post by:
Hi Folks, I have now spend app. 3 days to get the below scenario to work, but can not get there! ..Net version = 2.0.50727 Windows version = Microsoft Windows = Windows Server 2003 Now I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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.