Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpContext.Current.Request.Url giving 127.0.0.1

While debugging in Visual Studio which is running at following URL http://localhost:39452/ I am getting http://127.0.0.1 as the value for following property

 HttpContext.Current.Request.Url

instead of http://localhost:39452/ I am having this value in my hosts file:

::1  localhost

Can you let me what I am doing wrong here?

like image 373
Rocky Singh Avatar asked Jan 29 '14 16:01

Rocky Singh


2 Answers

Perhaps you are trying to get the HttpContext.Current.Request.Url value too early.

For example; during the Init event of a HttpModule you may face with these kind of problems. I mean you may get http://127.0.0.1/myApp instead of the correct value of http://localhost/myApp.

like image 166
yvzman Avatar answered Oct 18 '22 04:10

yvzman


Both are localhost; ::1 is the shorthand notation of the IPv6 version and 127.0.0.1 is the IPv4 version.

I guess your assumption that you are doing something wrong, is the only thing you're doing wrong! :)

like image 21
C.Evenhuis Avatar answered Oct 18 '22 03:10

C.Evenhuis