views:

329

answers:

5

How can I change the port number used by WebBrowser control? The standard port number is 80, but I would like to use a different port.

+8  A: 

You should specify an alternate port number in the URL itself:

http://server:port/path?query
Mehrdad Afshari
+4  A: 

The web browser control is a client. To connect to the server on different port, you change the URL.

ex: http://www.mysite.com:81/

would attempt to connect to the site on port 81.

billb
+1  A: 

Are you asking about the System.Windows.Forms.WebBrowser class?

If so, then set the Url property using the format Mehrdad mentioned, or go there using the Navigate() method:

http://server:port/path?query

Example:

WebBrowser w = new WebBrowser();
w.Navigate(new Uri("http://server:port/path?query"));
GreenReign
"Are you asking about the System.Windows.Forms.WebBrowser class?" - Yes
mykhaylo
A: 

If you're trying to change the local port of the web browser, I'm not sure that you can. The Windows API automatically assigns a local port to the browser.

Rob
A: 

You can use the DOS command "netstat -anb" to find out what process is holding port 81 on your machine.

djangofan