Can't log to Skype when I use Process.Start

516 views Asked by At

The problem that I have is that when I try to open Skype using Process.start in C#, the Skype window opens but when I put the user and password, I can't log on. But when i go directly to "C:\Program Files (x86)\Skype\Phone\Skype.exe" and I choose "Run as different user" (Shift + right clic),the Skype window opens, I put the credentials and in that case it works.

In Windows I have logged in, as local user and the user I need to run Skype is a Domain user. The connection to skype is through proxy.

I have checked in task manager, and the process starts with the correct user but somehow the behavior is different when I do it right clicking the folder and from the Process.start.

Here is my code:

ProcessStartInfo oPi = new ProcessStartInfo();
oPi.Domain = "Domain";
oPi.UserName = "User";
oPi.Password = oSecureString;
oPi.FileName = "C:\\Program Files (x86)\\Skype\\Phone\\Skype.exe";
oPi.UseShellExecute = false;
Process oP = Process.Start(oPi);
1

There are 1 answers

0
prasanth p On

Just put the code in the button's click event handler and use using System.Diagnostics as namespace to get Process:

protected void btn_Click(object sender, EventArgs e)
{
    try
    {
        Process.Start("C:\\Program Files (x86)\\Skype\\Phone\\Skype.exe");
    }
    catch (Exception ex)
    {
        Response.Write("" + ex);
    }
}