473,414 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to make a HttpWebRequest without specifying the port no?

I make a HttpWebRequest to the web which is hosted in the local host from my
C# application by the following code:
HttpWebRequest myHttpWebRequest =
(HttpWebRequest)WebRequest.Create("http://localhost:1035/Web/LogIn.aspx");

But every time I start the server the port no is changing which makes
changes to the above code. How can I get rid of it. Can't I make the request
without specifiying the port no? How can I make the above string independent
from the server port no?

Thanks in advance

Hope to see an answer soon.


Sep 4 '08 #1
5 2927
On Wed, 03 Sep 2008 20:27:00 -0700, nasayoo
<na*****@discussions.microsoft.comwrote:
[...]
But every time I start the server the port no is changing which makes
changes to the above code. How can I get rid of it. Can't I make the
request
without specifiying the port no?
Yes, but the server has to be on the standard HTTP port, 80.
How can I make the above string independent
from the server port no?
Configure your server so that it always uses the standard HTTP port: 80.

Pete
Sep 4 '08 #2
Configure your server so that it always uses the standard HTTP port: 80.
How to cofigure the server??
"Peter Duniho" wrote:
On Wed, 03 Sep 2008 20:27:00 -0700, nasayoo
<na*****@discussions.microsoft.comwrote:
[...]
But every time I start the server the port no is changing which makes
changes to the above code. How can I get rid of it. Can't I make the
request
without specifiying the port no?

Yes, but the server has to be on the standard HTTP port, 80.
How can I make the above string independent
from the server port no?

Configure your server so that it always uses the standard HTTP port: 80.

Pete
Sep 4 '08 #3
On Wed, 03 Sep 2008 21:22:01 -0700, nasayoo
<na*****@discussions.microsoft.comwrote:
>Configure your server so that it always uses the standard HTTP port: 80.
How to cofigure the server??
Impossible to answer without knowing how you've implemented the server.
Most HTTP servers would default to port 80 on their own. You obviously
have an exception to that rule. But beyond that, you haven't shared any
details that would help us answer.
Sep 4 '08 #4
As a simple way, I just edited the solution file of my webproject like below,
VWDPort = "80"
Now when I run the project, its running on the localhost - port 80. But I
have a doubt whether this change is permanent or not.
Btw: when I deploy it(I am going to deploy it in another machine), will it
change?
"Peter Duniho" wrote:
On Wed, 03 Sep 2008 21:22:01 -0700, nasayoo
<na*****@discussions.microsoft.comwrote:
Configure your server so that it always uses the standard HTTP port: 80.
How to cofigure the server??

Impossible to answer without knowing how you've implemented the server.
Most HTTP servers would default to port 80 on their own. You obviously
have an exception to that rule. But beyond that, you haven't shared any
details that would help us answer.
Sep 4 '08 #5
"nasayoo" <na*****@discussions.microsoft.comwrote in message
news:0F**********************************@microsof t.com...
As a simple way, I just edited the solution file of my webproject like
below,
VWDPort = "80"
Now when I run the project, its running on the localhost - port 80. But I
have a doubt whether this change is permanent or not.
Btw: when I deploy it(I am going to deploy it in another machine), will it
change?
When you deploy it, you won't be using the VSW embedded testing Web server,
obviously. So it will depend on the way the production Web server you're
deploying it to is configured.
Sep 4 '08 #6

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

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
9
by: Matt Sollars | last post by:
I've exhausted all other avenues with this problem. Any help would be greatly appreciated. I am performing a simple POST via a HttpWebRequest object to an SSL URL (https://). I have attempted...
2
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking...
1
by: Imran Aziz | last post by:
Hello All, I am using HttpWebRequest to fetch webpages in my ASP.net C# application. The request works fine without the proxy, but on using the code from within a network that uses proxy the...
1
by: Fred Herring | last post by:
I am trying to use httpwebrequest to post data. I have a question about how to define the url for the httpwebrequest. Dim request As HttpWebRequest =...
0
by: Nick | last post by:
Is there a way to avoid using a specific TCP port number, on the client side, when using HttpWebRequest? I've written an HTTP server and client that can't communicate with each other when the...
3
by: Sanjeev Purohit | last post by:
I am working on a VB .net application which accesses a Java Servlet. This servlet returns a binary stream that is written onto a PDF and then this file is printed. Even though this file is...
0
by: Brett Wesoloski | last post by:
A little about what I am trying to accomplish I am tyring to do a HttpWebRequest to a company called Paymentech. Here are some of there requirements: It supports one method of communication -...
5
by: mr.newsgroupguy | last post by:
I am working in C# .NET 1.1. My app has a button on its main form that checks to see if it has access to a file on our server, just an XML file. On our server we are running W2K IIS with a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.