locked
code to find what the localhost port number is? RRS feed

  • Question

  • User379720387 posted

    I want to create a link to another page on my site for display purposes.

    Already have it done for when the site is live, but now I need to figure out what the port number is for the localhost the site is running on at that moment.

    TIA

    Robert

    Wednesday, August 7, 2013 8:36 AM

Answers

  • User-760709272 posted

    Request.Url.Port

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 7, 2013 8:44 AM
  • User-1716253493 posted
    http://msdn.microsoft.com/en-us/library/system.web.httprequest.url.aspx
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 7, 2013 8:58 AM

All replies

  • User-760709272 posted

    Request.Url.Port

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 7, 2013 8:44 AM
  • User1256425868 posted
    Uri uri = HttpContext.Current.Request.Url;
    host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;

    Wednesday, August 7, 2013 8:48 AM
  • User-1716253493 posted
    http://msdn.microsoft.com/en-us/library/system.web.httprequest.url.aspx
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 7, 2013 8:58 AM