Capture the value of a Label [closed]

-1

I need to capture the value of a label (c #) that has been inserted via Jquery, eg:

 <asp:Label runat="server" ID="lblIPLocal" Visible="true"></asp:Label>

  //Alimenta a Label
  $("[id*=lblIPLocal]").text("teste");

  //Porem depois que alimenta a label retorna nulo 
  string dsUserIP = lblIPLocal.Text;
    
asked by anonymous 01.11.2017 / 17:41

1 answer

1

This is not necessary, you can get the user's IP on the server side without this "artifact".

Just check the Request.UserHostAddress in your code behind :

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.RequestType));
sw.WriteLine(Server.HtmlEncode(Request.UserHostAddress));
sw.WriteLine(Server.HtmlEncode(Request.UserHostName));
sw.WriteLine(Server.HtmlEncode(Request.HttpMethod));
    
02.11.2017 / 09:17