hello all
unable to open process or application path after i publish my asp.net web application using c# code
Access is denied
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: Access is denied
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) +6565246
System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) +93
System.Diagnostics.Process.Kill() +46
What I have tried:
this is my code :
protected void btnTeamViewer_Click(object sender, ImageClickEventArgs e)
{
foreach (Process proc in Process.GetProcessesByName("TeamViewer"))
{
proc.Kill();
}
string Path = "";
string curFile = @"C:\Program Files\TeamViewer\Version7\TeamViewer.exe";
if (File.Exists(curFile))
{
Path = @"C:\Program Files\TeamViewer\Version7\TeamViewer.exe";
Process p = System.Diagnostics.Process.Start(Path, PartnerIP);
Thread.Sleep(500);
}
else
{
curFile = @"C:\Program Files (x86)\TeamViewer\Version7\TeamViewer.exe";
if (File.Exists(curFile))
{
Path = @"C:\Program Files (x86)\TeamViewer\Version7\TeamViewer.exe";
Process p = System.Diagnostics.Process.Start(Path, PartnerIP);
Thread.Sleep(500);
}
else
{
}
}
}