locked
Client Public IP address and Location RRS feed

  • Question

  • User-1254072439 posted

    How do i get web client public ip address and country ?

    Thursday, February 1, 2018 5:01 AM

Answers

  • User-492460945 posted

    Hello tikaramk

    Please check the below links. You may have to use external tools to achieve this.

    Thanks,

    Rajesh

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2018 9:21 AM
  • User-832373396 posted

    <g class="gr_ gr_8 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="8" data-gr-id="8">Hi</g> <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling" id="5" data-gr-id="5">tikaramk</g>,

    How do i get web client public ip address and country ?

    Sir, please refer to this infromation in c#;

    • Client IP:
    Request.UserHostAddress
    • Client Host Name
    Request.UserHostName 
    • Client browser ep.IE
    Request.Browser.Browser; 
    • User Country (I tested it in MVC with the Chrome Browser )
    Request.UserLanguages	{string[2]}	string[]
    		[0]	"en-US"	string
    		[1]	"en;q=0.9"	string
    

    note: In fact, it gets the user language of requesting Browser(ep.Chrome), but if we only want to get the Country, not detail location, i recommend this way Request.UserLanguages because it doesn't rely on 3rd site or tool;

    Guides

    Welcome to back if any question :)

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 2, 2018 8:06 AM

All replies

  • User-492460945 posted

    Hello tikaramk

    Please check the below links. You may have to use external tools to achieve this.

    Thanks,

    Rajesh

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2018 9:21 AM
  • User-832373396 posted

    <g class="gr_ gr_8 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="8" data-gr-id="8">Hi</g> <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling" id="5" data-gr-id="5">tikaramk</g>,

    How do i get web client public ip address and country ?

    Sir, please refer to this infromation in c#;

    • Client IP:
    Request.UserHostAddress
    • Client Host Name
    Request.UserHostName 
    • Client browser ep.IE
    Request.Browser.Browser; 
    • User Country (I tested it in MVC with the Chrome Browser )
    Request.UserLanguages	{string[2]}	string[]
    		[0]	"en-US"	string
    		[1]	"en;q=0.9"	string
    

    note: In fact, it gets the user language of requesting Browser(ep.Chrome), but if we only want to get the Country, not detail location, i recommend this way Request.UserLanguages because it doesn't rely on 3rd site or tool;

    Guides

    Welcome to back if any question :)

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 2, 2018 8:06 AM