Web Forms :: Using System.Diagnostic.Process In A Web Application?
Mar 10, 2011
I need to use [System.Diagnostics.Process ] class in my web project to execute a *.exe file. I can also use the [CreateNoWindow ] property to make it invisible while it does it job behind the scenes. However, webhosting companies do not allow .exe files to be executed on the web. I read some where that if I place the same code (which invokes the .exe file) in a separate class library project and use the respective [dll] in my web application, it will work.
View 4 Replies
Similar Messages:
Jul 15, 2010
I've an application where in am trying to show a slideshow directly on page load.. for that am using the following code
[Code]....
Its perfectly working on the dev environment but when deployed onto iis7.. am not able open the file..
I've given all folder rights for asp.net account and network service..
View 5 Replies
Sep 7, 2010
I've written a aspx.net(C#) page that after the user has done what they do on the page they hit a Submit button. The Submit button
1) takes the work the users was producing on the page and writes it to a file.
2) attempts to execute a batch file.
The call to the batch file is executed via:
protected void Execute123EDI()
{
try
{
string File = @"c:80sAdminSendV80s.bat";
lblCancelled.Text = lblCancelled.Text + File;
Process proc = new System.Diagnostics.Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.LoadUserProfile = false;
proc.StartInfo.UserName = "administrator";
proc.StartInfo.RedirectStandardOutput = true;
System.Security.SecureString secPass = new System.Security.SecureString();
string paswd = "123abc";
for (int i = 0; i < paswd.Length; i++)
{
secPass.AppendChar(paswd[i]);
}
proc.StartInfo.Password = secPass;
proc.StartInfo.FileName = File;
proc.Start();
FileStream fs = new FileStream(@"c:80sAdminSendV80sOutput.log", FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.Write(proc.StandardOutput.ReadToEnd());
proc.WaitForExit();
sw.Close();
proc.Close();
}
catch(Exception ex)
{
lblDebug.Text = lblDebug.Text + ex.Message + "<br/>";
}
If I watch the processes tab in Task Manager on the web server I see "cmd.exe" under the context of 'administrator' but it just hangs. For test purposes c:SendV80s.bat: copy c: oot.ini c:zzz.txt
If I logon onto the webserver's console and execute SendV80s.bat it works and exits without issue. But when I execute the same batch file via the Submit button it gets stuck executing in Task Manager/Process. I believe this has something to do with the fact that cmd is not running in a full environment/desktop context. I just noticed this on the actual console of the webserver (not in my RDP console but console 0 instead)
A pop-up box stating: CMD.exe Application error The application failed to initialize properly (0xc0000142). Click OK to terminate the application. And when I click on the OK button my ASPX page's WaitForExit is satisfied and the continues processing normally.
View 2 Replies
Feb 26, 2010
I'm working on an ASP.net app I'm trying to execute a process remotely , using System.Diagnostics.Process class here's my code:
ProcessStartInfo startInfo = new ProcessStartInfo(@"C:TestCommand.exe");
startInfo.Domain = "myDomain";
startInfo.UserName = "MyUserName";
SecureString sec = new SecureString();
foreach (char item in "MyPassword")
{
sec.AppendChar(item);
}
sec.MakeReadOnly();
startInfo.Password = sec;
startInfo.UseShellExecute = false;
Process.Start(startInfo);
I keep receiving an exception with the message "Logon failure: unknown user name or bad password". Im absolutelly sure that i'm submiting my correct username/pwd
View 1 Replies
Jan 26, 2010
When I hit the run button (in my Default.aspx), a process starts (this process contacts a webservice to get some files, etc). How do I: Ensure that only a single process is running at a time (i.e. if I refresh the browser, I don't want to start the process a second time)Track progress - there are 4 points of the process (at 25%, 50%, 75%, 100%) that I want to track, and when each part completes, I want to update the progress bar. I have a status object for the running process, but the question is how to update the progress bar automatically? Do I need to use threads to achieve the above two?
View 1 Replies
Aug 20, 2010
I'm trying to write a text file form my web page, But every time I'm having this error System.IO.IOException: The process cannot access the file '.txt' because it is being used by another process. This is mode code for write file.
Code:
protected void btnSave_Click(object sender, EventArgs e)
{
string serverpath = Server.MapPath("\proactivcust.ini");
string mappath = "";
string qbpath = "";
string archpath = "";
string workpath = "";
try
{
System.IO.StreamReader file = new System.IO.StreamReader(serverpath);
[Code.....]
View 9 Replies
May 5, 2010
I am trying to use the unmanaged ImageMagick library in my ASP.NET application from the command line using System.Diagnostics.Process. Basically, users will upload an .eps file to the site, and then I will run the command line command to convert it into .jpg. This is the code I'm using to try and run the command:
Dim proc As New System.Diagnostics.Process
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.RedirectStandardError = True
proc.StartInfo.FileName = "C:Program Files (x86)ImageMagick-6.6.1-Q16convert.exe"
proc.StartInfo.UseShellExecute = False
proc.StartInfo.Arguments = String.Format("{0} {1}", Server.MapPath("~/logo/test.eps"), _
Server.MapPath("~/certificates/temp/test-1234.jpg"))
proc.StartInfo.CreateNoWindow = True
proc.Start()
I am able to run this code just fine on our development Win 2k3 server, but not on our production Win 2k3 Server. I get the error "System.ComponentModel.Win32Exception: Access is denied". The main between the two servers is that the production is 64-bit and runs Plesk to manage multiple domains. I've tried adding rights asp.net user to the ImageMagick directory. The PS Admin says that in the case of Plesk, it's the same account that I use to access the site in VS using FPE. Does anyone know what I might do in order to allow this process to run on my production server?
View 1 Replies
Jan 13, 2011
When I run System.Diagnostics.Process.Start from my console application it works but the same code when I run from my web service hosted in IIS doesn't work.
Is it some thing to do with ASP.Net privileges?? if yes how can I configure it from my C# code.
View 1 Replies
Jun 24, 2010
I am working on migrating a site from IIS 6 to IIS 7 and I am not able to see all of my logs. My system.diagnostics configuration is as follows:
<system.diagnostics>
<trace autoflush="true"></trace>
<sources>
<source name="Assembly1" switchValue="All">
<listeners>
[Code]....
If I run the application locally using the ASP.Net web server or local IIS I get all my log files. Once the application has been deployed to IIS 7 I only get the System.ServiceModel log. I have verified that the directory exists and I have given full control to everybody. I also have restarted the services and the site in an attempt to force the logs to flush. I have just been trying anything to get a log out of this thing so I also installed the Tracing and Logging Tools role services. I still don't get my application logs.
I also tried an implementation where I logged to the EventLog instead of trace log files. This also exhibited the same behavior. Worked locally and when deployed to local IIS but not when deployed to the actual server. I logged to the application log and on my IIS7 machine I gave full control permission to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetserviceseventlogApplication.
Seems like I must be missing something here. I can't get any information out of these 2 different logging implementations when deployed within IIS 7. I'm not even sure what is common here. Do EventLog.WriteEntry and Trace.TraceEvent both use WCF?
View 1 Replies
Jun 9, 2010
I am in the process of creating an audit trail system. Simple enough. Certain fields require audit trail. What is the best design concept to allow this to work in multiple applications without having to change much? I would of course leave it to the admin of the site to add what fields should be audited, but the logic is the problem. Would implementing the interface IComparable be a place to start? My initial thinking is to compare 2 arrays against eachother and do an insert of what fields are in question. Array1 are the fields in the form, array2 are the fields from the sql table that require auditing.
View 8 Replies
Jun 30, 2010
I can not run System.Diagnostics.Process.Start(@"wmplayer.exe") in code behind under IIS, - nothing happens, though I can do it successfully using Visual Studio ASP.NET Development server. I read topic http://support.microsoft.com/kb/555134 and made as recommended: 1) Made ASP.NET worker process run in SYSTEM account 2) Enabled IIS Admin Service to interact with desktop and rebooted serivce. - wmplayer.exe does not start, even its process does not start. I tried start notepad.exe and it partly works - process starts, I see only window frame, but not menu and can not interact with it. The other thing I tried is to put it under out-of-process (IIS virtual folder properties) and gave the process administrative rights (changed identity in Component Services): no result.
View 6 Replies
Aug 31, 2010
I have code that runs under IIS6 & ASP.Net 2.0, that won't run under IIS7.5 on Windows Server 2008 R2. I am assuming I have a configuration problem - but I don't know. On a Windows Sever 2008 R2 system: From inside IIS (v7.5), an ASP.NET process will not connect to port 21 (ftp) on the ICS (using System.Net.Sockets.Socket), it fails, logging an error that it cannot connect to the system at nnn.nnn.nnn.nnn. But, from a command prompt on the same server though, I am able to connect via ftp to the system at nnn.nnn.nnn.nnn. I am using the DefaultAppPool.
Here's a code snippet:
[Code]....
And the connect throws an exception - unable to connect I'm firing up wireshark soon and I'll see what if anything is getting across the wire? particularly if you think it's administrative in nature, cause that's a real weak point for me.
View 2 Replies
Jan 7, 2011
I have installed VS2008 on my development machine have winxp sp2 OS.i have created one aspx page where i have placed one button. On click of that button i want to open osk.exe(on screen keyboard). i an using following code
System.Diagnostics.Process.Start("osk.exe")i works fine there.Now for testing i deployed that application to testing server having Win7 OS and IIS7.0. It is not working there.
View 2 Replies
Jul 26, 2010
System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server
View 3 Replies
Jan 22, 2010
Can anyone tell me the differnce between
System.web.httpcontext.current.application["tag"]
or
System.Configuration.Appsettings["tag"]
View 2 Replies
Jan 29, 2011
i developed one asp.net application.i published the application in iis server.then by using that url i am testing the application in my system the design is coming fine.But in other systems the design is vary.both the systems are having IE8 Browser and both are same versions.
why the designing is vary can u pls let me know.
and also button styles all are different changing in system to system.
View 1 Replies
Mar 9, 2011
I am logged in as the administrator when I installed an application named pdflatex.exe on my server. This application works as a converter from LaTeX input file to Pdf file. I host an Asp.net MVC 3 application running under an Application Pool Identity with Load User Profile = True. The Asp.net MVC 3 code contains a code that executes pdflatex.exe using System.Diagnostic.Process instance as follows:
Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath;
p.StartInfo.WorkingDirectory = @"c:mydomain.comworking";
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "pdflatex.exe";
p.Start();
p.WaitForExit();
From the scenario above, the web application runs under a restricted acount but it executes an external application under a default account that I don't know. Can an application running under a less privileged account start a process executing another application under an administrative account?
View 2 Replies
Apr 3, 2010
I've developed a popup email .aspx used on our intranet based web app that is auto generated with .pdf's attached. I'm developing with VS 2008 ASP.Net 3.5 C# and System.Net.Mail.MailMessage. I can create and send the email with no issues. The problem is with any attempt to open or delete the attachments I get the above error. The .pdf's a copied with the following code:
FileStream fsr = new FileStream(inFilename, FileMode.Open, FileAccess.Read, FileShare.Read);
BinaryReader reader = new BinaryReader(fsr);
byte[] bytes = new byte[fsr.Length];
reader.Read(bytes, 0, bytes.Length);
FileStream fsw = new FileStream(outFileName, FileMode.Create, FileAccess.Write, FileShare.Write);
BinaryWriter writer = new BinaryWriter(fsw);
writer.Write(bytes, 0, bytes.Length);
// clean up
writer.Flush();
writer.Close();
writer = null;
fsw.Close();
fsw.Dispose();
fsw = null;
reader.Close();
reader = null;
fsr.Close();
fsr.Dispose();
fsr = null;
Later after sending the email I:
mailMessage.Dispose();
mailMessage = null;
foreach (string fileName in attachments)
{
if (File.Exists(fileName))
File.Delete(fileName);
}
The error occurs at: the File.Delete(fileName);
how I can delete or reopen these files after sending the email?
View 9 Replies
Oct 7, 2010
I'm building an ASP.NET MVC site where I want to use OpenSTV to conduct polls. To run results through OpenSTV, I'd have to run the executable. Is that allowed from a medium-trust ASP.NET application?
View 1 Replies
Jan 24, 2011
In IIS application pool I have set 2 in maximum worker process in process model, will application object, session object and cache object will be shared by the all worker process or will all worker process have different application object, session object and cache object.
View 1 Replies
Mar 30, 2010
Running an ASP.NET application in its own app pool on Windows Server 08 / IIS 7.
Server keeps hitting 97% memory usage and sticking there, trying to work out if that is our application's fault.
My main question is, does all of the memory used by an application get displayed as the working set for the w3wp.exe process associated to it? Our application (according to IIS7 and the worker process in task manager) is using less then 350mb. I want to know if it is possible for our application to be using 5GB of memory but only showing 350mb for the process?
View 9 Replies
Dec 7, 2010
What is the difference between IIS Worker process, Application pool and application domain? Do we have more than one application domains in one application pool?Does one application domain means one virtual directory?
If we have 2 virtual directories pointing to same physical folder. Will they share the same memory or different when there instances are opened in the browser? Will they be in 2 different application domains?
View 2 Replies
Oct 18, 2010
I am trying to config my application to use out-of-process sessionState.
<sessionstate mode="stateserver" cookieless="false" timeout="20" sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>" server="127.0.0.1" port="42424" />In my web.config I get errors for the server and port attributes, telling me that server attribute is not allowed and port attribute is not allowed.
View 2 Replies
Sep 6, 2010
Is it possible for an asp.net application to read a file which is used by another process?
View 9 Replies
Apr 11, 2010
Coming to my task, I have to schedule a process which will delete all the files in the paticular table with particular key.I have the stored procedure for the deletion. What all I need is, How to schedule this process in the application server.?
View 5 Replies