Forum Discussion

f5now_28704's avatar
f5now_28704
Icon for Nimbostratus rankNimbostratus
Dec 17, 2008

passing client IP to server

hey crew,

 

 

I have a server app that requires the client IP pop in the ASPX. I tried some irules I had found in the forums.. they did work... not sure where to look to have this work.

 

 

client ASPX string..

 

String IP = HttpContext.Current.Request.UserHostAddress

 

 

currently its popping up with the F5 interface IP.

 

 

Ryan
  • I assume you are using the snat feature on the F5 and that it is not the default gateway? If this is the case, you'll want to enable the Insert XForwarded For header in the http profile and configure your app to read this header to retrieve the source IP of the user.
  • Hi,

     

    sorry I had posted this and next day we had a power failure and I had forgot I posted...

     

     

    anyway, thanks.. this worked for me, I enabled the profile-http for "Insert XForwarded For" to enable and that passed the client IP to my server where I wrote this to catch and display it in ASP.

     

     

    <%@ LANGUAGE="VBSCRIPT" %>

     

     

     

    Grab IP Address

     

     

    <% ClientIP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")%>

     

     

     

    Your IP Address is <% Response.Write(ClientIP)%>

     

     

     

     

     

     

    Thanks Again.

     

    Ryan