Hello-World
Hello-World

Reputation: 9545

Code to get all ports used by ASP.NET Development Server

In my solution I have 5 websites that run locally on Visual Studios ASP.NET Development Server.

Is there some code (C# or VB.NET) in the code behind of one of those sites that can find all the ports used by the ASP.NET Development server?

Upvotes: 2

Views: 337

Answers (2)

immutabl
immutabl

Reputation: 6903

Take a look at the Web Administration API, you will need to look especially at the Site object.

Upvotes: 1

Ravi Gadag
Ravi Gadag

Reputation: 15851

try. Request.Url.Port

Request.Url.Port // will give the port of the server. 

Upvotes: 0

Related Questions