Skip to main content

Command Palette

Search for a command to run...

cara mudah display IP di razor page ASP.NET

Updated
1 min read
cara mudah display IP di razor page ASP.NET
G

gua memang serious cakap lu, gua serious 24 jam. baik di jamban ,di meja makan atau bersenggama . serius...dohhh

mula create public string variable in Model page

public string? Ip { get; set; }

kemudian initialize kan di OnGet()

        public void OnGet()
        {           
            Ip = HttpContext.Connection.RemoteIpAddress?.ToString();
        }

finally , kat View Page

<p>Your IP Address: @Model.Ip</p>

sekadar nota, happy coding guys

More from this blog

G

gua serius

18 posts

serius dohhhh!