I want to create a C# application to create a WLAN network. I currently use netsh using command prompt. My application should do this in button click. Here is the command I use in command prompt in admin mode "netsh wlan set hostednetwork mode=allow ssid=sha key=12345678" after that I enter "netsh wlan start hostednetwork". When I do this i can create a wifi local area network. In C# I coded like below
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.FileName = "netsh.exe";
p.StartInfo.Arguments = "wlan set hostednetwork mode=allow ssid=sha key=12345678"+"netsh wlan start hostednetwork";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
}
You shouldn't do this:
+"netsh wlan start hostednetwork"
to the arguments of the first process. That would mean that you are typing this at the console:Instead, make a new process for the second line: