473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enable/ disable a LAN connection

yyy
Hello,
Can someone please tell me how can I enable/ disable a LAN connection
using C#.NET?

Thanks in advance :D

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #1
6 7059
I know of a couple of ways to do this. One is to use interop calling
WNetCancelConne ction2 (see links below) or you can use the WMI class
Win32_NetworkCo nnection and use the ConnectionState property to disconnected
to turn it off.

I hope this helps
--------------------
interop links
http://www.pinvoke.ne
http://msdn.microsoft.com/library/de...connection.asp

WMI lin
http://msdn.microsoft.com/library/de...connection.asp

Nov 16 '05 #2
Win32_NetworkCo nnection ConnectionState is read-only. You can't change it's
state.
Only thing you can do using WMI is unloading/loading the device driver for
you connection (exactly as the Control pannel Connections applet does when
disabling/enabling).

Willy.
"Brian Brown" <Br********@dis cussions.micros oft.com> wrote in message
news:BE******** *************** ***********@mic rosoft.com...
I know of a couple of ways to do this. One is to use interop calling
WNetCancelConne ction2 (see links below) or you can use the WMI class
Win32_NetworkCo nnection and use the ConnectionState property to
disconnected
to turn it off.

I hope this helps
--------------------
interop links
http://www.pinvoke.net
http://msdn.microsoft.com/library/de...connection.asp

WMI link
http://msdn.microsoft.com/library/de...connection.asp

Nov 16 '05 #3
It's not clear what exactly you want to achieve.
Do you wan't to disconnect from a remote resource (a file share for
instance), or do you wan't to disconnect a client session from a shared
resource?
Or is it something else?

Willy.

"yyy" <ma******@bezeq int-dot-net.no-spam.invalid> wrote in message
news:41******** **@Usenet.com.. .
Hello,
Can someone please tell me how can I enable/ disable a LAN connection
using C#.NET?

Thanks in advance :D

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 16 '05 #4
My error with the connection state. Thanks Willy.

You can still use interop to disconnect... that is if this what you are
looking for.

Good luck.

Nov 16 '05 #5
Brian,

I'm pretty sure the solution is in System.Manageme nt (WMI), but first we
have to know exactly what OP is looking for.

Willy.

"Brian Brown" <Br********@dis cussions.micros oft.com> wrote in message
news:80******** *************** ***********@mic rosoft.com...
My error with the connection state. Thanks Willy.

You can still use interop to disconnect... that is if this what you are
looking for.

Good luck.

Nov 16 '05 #6
yyy
Who is Brian ?

What do you mean by "What OP looking for" ?

I couldn't do it with WMI. Do you have another idea ?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
15948
by: Alphonse Giambrone | last post by:
I am trying to enable/disable a requiredfieldvalidator on the client side and am generating an error. I had found some documentation on validation which states that I should be able to enable/disable validators on the client side. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspplusvalid.asp According to it and the little other info I was able to find, the way to accomplish what I want it to call...
3
3793
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76) and they were put onto the form in the numerical sequence. I have given the A's with B & C's on the same line a tag=1; B.tag=2, C,tag=2) I am trying to write 2 modules so that the following occurs (on Form_Current and 'A' Control_Before or...
0
2409
by: talal | last post by:
How to check whether javascript is enable or disable in client browser. Remeber i can check wheter browser client support javascript with BrowserCapability class. But what if the client has disable from security setting in a browser. Tell me is there any class like browserCapability in asp.net to check wheter javascript is enable or disable. Please dont tell me the html way or do some javascript because i have to apply this code into...
0
6545
by: 4AspNet | last post by:
Hello. I need to disable and then enable Local Network Connection (Ethernet). Here is my code: IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties(); NetworkInterface nics = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in nics) { if (adapter.NetworkInterfaceType !=
8
34447
by: rongchaua | last post by:
Hi all, i would like now to disable and enable network adapter programmatically with c#. I have searched but found nothing useful. There's no topic about this problem. Has someone done with this problem? All help will be appreciated. rongchaua.
3
11644
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm very new to VBA,i tried to follow the instructions reported in the code,but i got no result,i still can use the shift key,can you explain in details how to use it correctly to enable/disable users from pressing shift key to view database windw?,the...
2
4366
by: Naushad | last post by:
Hi all, I am using the countinous form. I want to Enable/Disable the some fields for perticular records as per the following condition when open the form. I have written this code in "On Current Event". I go on the perticular record its enable/dosable the following field for all records. I have tried this code in "On Open Even" but there is no effect. Please help me to solve this problem.
10
9090
by: sowmyati | last post by:
HI All, I am new to javascript. I have snippet wherein i am giving a brief note on what i am trying to do. In the below have a variable by name stuff. trying to reset the page. Part of the code which does reset is attached below. there is a reset button which will reset the connection and it takes two min for data loading during which the reset button has to be disabled and later after two mins it should enable the button for the user. ...
1
2816
by: ram121 | last post by:
how to disable and enable the local area connection using vb 6.0 codes
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8535
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.