473,805 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically change IP Address

DMA
How can I change my IP address ?
I try to do it in C#.
It's easy to get the IP but to fix it is another problem..

Thanks.

Sep 8 '06 #1
4 4667
WMI as usual :)
http://www.dotnet247.com/247referenc...20/104068.aspx

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"DMA" wrote:
How can I change my IP address ?
I try to do it in C#.
It's easy to get the IP but to fix it is another problem..

Thanks.

Sep 8 '06 #2
WMI as usual :)
http://www.dotnet247.com/247referenc...20/104068.aspx
As I recall WMI isn't active by default on Windows Server 2003 (needs to be
turned on via "Add/Remove Windows Components" under "Add/Remove" programs in
the Control Panel). Those targetting this platform then have a problem
(forcing customers to activate this feature which they may not want to do).
Sep 8 '06 #3
DMA
I have found something about that and actually I am trying to get it
work.
Thank you.
I will see on monday.
I just had to add a reference to System.Manageme nt that is not by
default in C# Express.
Michael Nemtsev wrote:
WMI as usual :)
http://www.dotnet247.com/247referenc...20/104068.aspx

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"DMA" wrote:
How can I change my IP address ?
I try to do it in C#.
It's easy to get the IP but to fix it is another problem..

Thanks.
Sep 8 '06 #4
DMA
That code works very well ! :
ManagementBaseO bject inPar = null;
ManagementBaseO bject outPar = null;
ManagementClass mc = new
ManagementClass ("Win32_Network AdapterConfigur ation");
ManagementObjec tCollection moc = mc.GetInstances ();
try
{
foreach (ManagementObje ct mo in moc)
{
if (!(bool)mo["IPEnabled"])
continue;

inPar = mo.GetMethodPar ameters("Enable Static");
inPar["IPAddress"] = new string[] {
"10.59.245. 186" };
inPar["SubnetMask "] = new string[] {
"255.255.0. 0" };
outPar = mo.InvokeMethod ("EnableStatic" , inPar,
null);
MonIP.Text = "10.59.245.186" ;
}
}
catch (Exception ex)
{
MessageBox.Show ("Problème au changement d'IP (" +
ex.Message + ")", "erreur", MessageBoxButto ns.OK,
MessageBoxIcon. Error);
return;
}

Sep 11 '06 #5

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

Similar topics

3
2112
by: Dave Nouwens | last post by:
Hi All, Please accept my appologies in advance for what I expect will be a reasonably simple question. I have an html form (which is generated in php) which contains a number of rows (one row per product in the 'products' table). It is generated with the following php
5
9774
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
27
13080
by: ted benedict | last post by:
hi everybody, i hope this is the right place to discuss this weird behaviour. i am getting dynamically generated text or xml from the server side using xmlhttprequest. if the server side data is STATIC, i can have whatever size of data i want. but if the data (xml or text) is generated dynamically using php, then there seems to be a size limit! xmlhttprequest's responseText is truncated, and the xml therefore not well fromed. in border...
94
4788
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring that I found inside of a string. Any ideas?
36
3208
by: Martin Larsen | last post by:
Hi, When a PHP program links to a library using include or require (or their _once variations), is the library then linked dynamically or statically? While it might seem irrelevant from a technical point of view, the linking method is important when it comes to licencing issues as some licences, like GPL, differ between those kinds of linking when it comes to viewing the library as a derivative work of the main program.
1
7555
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and having the sql statement dynamically built according to the input provided by the user. I have used the method described here hundreds of times it is quick and adaptive. I generally use a frames page for the search, in this way the search is maintained...
1
2077
by: John Dow | last post by:
I have an ASP.Net project, in which I added a web reference, for example http://Sandbox/service.asmx after I pass the testing, I want to change the web service address to http://Production/service/asmx, which has the exactly same interface as the sandbox. My question is how to dynamically configure the ASP.Net application point to the right web service address after I deploy the code from test to production enviroment without recompile...
2
6540
by: ssmith147 | last post by:
Hi, I'm somewhat familiar with access and vb programming (I can read someone else's code, for the most part), but I'm still very green when it comes to creating solutions for my own needs. I'm trying to create a db for a friend's business. I have two issues that I'm wrestling with. First is how to dynamically create a text box on a form. I'm building a form that relates information between two tables (A, B). Table B is the source of...
1
4915
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have set text boxes and labels inside the table rows. I then added a button. All of these are done through code. The problem that i am having is i can get the value from a text box with resides inside the first panel (out side of panel that is...
1
2089
by: nsteiner | last post by:
Hi all On my web page I have a 3 column table. The first cell changes background color when mouseover event occurs. Something like this : <TR><TD onMouseOver="this.bgColor='#00CC00'" onMouseOut="this.bgColor='#F0FFF0'" >name</TD> <TD>number</TD> <TD>address</TD><TR> This works fine.
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10366
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
10105
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
9185
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
7646
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
6876
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();...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4323
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
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.