Organizational Research By

Surprising Reserch Topic

how to get full host name port number in application start of global aspx


how to get full host name port number in application start of global aspx  using -'c#,asp.net,url,request,hostname'

I tried

Uri uri = HttpContext.Current.Request.Url;
String host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;


and it worked well on my local machine, but when being published to IIS7, there is an exception saying

System.Web.HttpException: Request is not available in this context


Anyone know how to achieve this?
    

asked Sep 9, 2015 by Mari21Enfyjz
0 votes
32 views



Related Hot Questions

4 Answers

0 votes
NULL
answered Sep 9, 2015 by JuliusMackni
0 votes
NULL
answered Sep 9, 2015 by TeganURKXmuo
0 votes
NULL
answered Sep 9, 2015 by FYWJessievyt
0 votes
NULL
answered Sep 9, 2015 by SteNixon

...