Search code examples
c#adhoc

Ad Hoc using C#


I am using Windows 8 and ended up realizing that he no longer has support for creating Ad Hoc networks. The only possible way to create such a network is by console command:

netsh wlan set hostednetwork mode=alow ssid=ssid key=key
netsh wlan start hostednetwork

I started doing a program in C# using a function that executed the command console using this example: Execute Shell Command using C#

Unfortunately some commands only work in administrator mode, and I could not get the console commands work as an administrator directly by code.

Here's my question: Is there any library or API in C # to create an Ad Hoc network?


Solution

  • Are you running your program as Administrator? If you're running it in the debugger then running the debugger as Administrator will cause your program to as well.