<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Rainbow Portal</title><link>http://forums.asp.net/102.aspx</link><description>Discuss the Rainbow Portal Project for ASP.NET 1.x and above.  &lt;a href="http://www.rainbowportal.org/" target="_blank"&gt;Rainbow Home&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3574473.aspx</link><pubDate>Sat, 19 Dec 2009 18:27:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3574473</guid><dc:creator>jamalqudah</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3574473.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3574473</wfw:commentRss><description>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;just use this code&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="vb.net"&gt;Dim IP_Address As String = Request.UserHostName&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div style="position:absolute;left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden;" id="_mcePaste"&gt;inside the code behind page page.aspx.vb not inside a class and it will work&amp;nbsp;&lt;/div&gt;
&lt;div style="position:absolute;left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden;" id="_mcePaste"&gt;&lt;/div&gt;
&lt;div style="position:absolute;left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden;" id="_mcePaste"&gt;if you need to use inside the class just pass it with the class&lt;/div&gt;
&lt;div style="position:absolute;left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden;" id="_mcePaste"&gt;&lt;/div&gt;
&lt;div style="position:absolute;left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden;" id="_mcePaste"&gt;ex code:&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;inside the code behind page page.aspx.vb not inside a class and it will work&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;if you need to use inside the class just pass it with the class&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;ex code:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="vb.net"&gt;Imports Microsoft.VisualBasic

Public Class Testing


Public Shared Function TEsting(ByVal IPaddress As string) As String
&amp;#39;insert to database as log
dim IP as string = IPaddress 

connect.ExecuteScaler(&amp;quot;INSERT INTO blabla(IP_Address) &amp;quot; &amp;amp; _
  &amp;quot;VALUES (&amp;quot; &amp;amp; IPaddress  &amp;amp; &amp;quot;)&amp;quot;)

        Dim result As String = &amp;quot;&amp;quot;
        Return result
    End Function
 End Class&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;in code behind page call the function and pass the IP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="vb.net"&gt;TEsting(Request.UserHostName)&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;p&gt;thats it&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;hope this help&lt;/p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3574422.aspx</link><pubDate>Sat, 19 Dec 2009 17:23:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3574422</guid><dc:creator>samuel24</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3574422.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3574422</wfw:commentRss><description>&lt;p&gt;Hi Getting users Ip address code is in the below link.may be it will useful for some one.&lt;/p&gt;&lt;p&gt;&lt;a href="http://dotnetpgm.blogspot.com/2009/09/how-to-get-ip-address-in-aspnet.html"&gt;http://dotnetpgm.blogspot.com/2009/09/how-to-get-ip-address-in-aspnet.html&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3553735.aspx</link><pubDate>Tue, 08 Dec 2009 10:49:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3553735</guid><dc:creator>liza20005</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3553735.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3553735</wfw:commentRss><description>&lt;p&gt;hmmm nice very niceeeee&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3514036.aspx</link><pubDate>Sun, 15 Nov 2009 19:42:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3514036</guid><dc:creator>jamalqudah</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3514036.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3514036</wfw:commentRss><description>&lt;p dir="ltr"&gt;simply if you run the code on a class or the global you wont be able to get the remote IP address &lt;/p&gt;
&lt;p dir="ltr"&gt;just run this code on any code behind page and you&amp;#39;ll get the remote user IP &lt;/p&gt;
&lt;p dir="ltr"&gt;&amp;nbsp;Request.UserHostName&lt;/p&gt;
&lt;p dir="ltr"&gt;you can try my URL &lt;a href="http://www.jamalq.com/testing.aspx"&gt;http://www.jamalq.com/testing.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p dir="ltr"&gt;if you need the IP on the class just pass it through string &lt;/p&gt;
&lt;p dir="ltr"&gt;&amp;nbsp;hope this help&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3504985.aspx</link><pubDate>Tue, 10 Nov 2009 18:24:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3504985</guid><dc:creator>alikhanweb</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3504985.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3504985</wfw:commentRss><description>&lt;p&gt;This worked&amp;nbsp;for me. &lt;/p&gt;
&lt;p&gt;Thank you so much. &amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3497551.aspx</link><pubDate>Fri, 06 Nov 2009 07:01:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3497551</guid><dc:creator>Manwatkar</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3497551.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3497551</wfw:commentRss><description>&lt;p&gt;dear sir,&lt;/p&gt;&lt;p&gt;i have tried this als but it is giving me ip 127.0.0.1 can u tell me &lt;/p&gt;&lt;p&gt;Dim strHostName As String = System.Net.Dns.GetHostName()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim clientIPAddress As String = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString()&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;when i applying this code on local host it is working fine but when i was using it on server it is giving this ip address 10.49.39.51 which ip address is this bcoz i was getting same ip address whn i using it from anywhere...&lt;/p&gt;&lt;p&gt;is there any other way to get the ip address which really work...please help me out....thnks in advance...&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3496724.aspx</link><pubDate>Thu, 05 Nov 2009 18:55:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3496724</guid><dc:creator>villandro</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3496724.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3496724</wfw:commentRss><description>&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;Try this:&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;string clientIP = Request.UserHostAddress.ToString();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3495787.aspx</link><pubDate>Thu, 05 Nov 2009 10:44:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3495787</guid><dc:creator>Manwatkar</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3495787.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3495787</wfw:commentRss><description>&lt;p&gt;dear sir.&lt;/p&gt;&lt;p&gt;i have applied your code in my project&lt;/p&gt;&lt;p&gt;string strHostName = System.Net.Dns.GetHostName();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();&lt;/p&gt;&lt;p&gt;but it working correctly on localhost but when i am trying on the server it is giving as address like this 10.49.23.4 which address is this please reply me what is the problem....my email address is pank_manwatkar2007@yahoo.com thanks in advance....&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3495772.aspx</link><pubDate>Thu, 05 Nov 2009 10:32:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3495772</guid><dc:creator>Babunareshnarra</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3495772.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3495772</wfw:commentRss><description>&lt;p&gt;Try this &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Request.ServerVariables[&amp;quot;REMOTE_ADDR&amp;quot;]&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3489412.aspx</link><pubDate>Mon, 02 Nov 2009 14:15:19 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3489412</guid><dc:creator>TATWORTH</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3489412.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3489412</wfw:commentRss><description>&lt;p&gt;If you are trying to get your own external IP Address, please see &lt;a target="_blank" href="http://externalip.codeplex.com/"&gt;http://externalip.codeplex.com/&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3481137.aspx</link><pubDate>Wed, 28 Oct 2009 09:20:46 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3481137</guid><dc:creator>viveksisodia</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3481137.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3481137</wfw:commentRss><description>&lt;p&gt;HttpContext.Current.Request.UserHostAddress.ToString()&lt;/p&gt;&lt;p&gt;Request.ServerVariables[&amp;quot;REMOTE_ADDR&amp;quot;].ToString()&lt;/p&gt;&lt;p&gt;both are the same.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3310148.aspx</link><pubDate>Thu, 23 Jul 2009 22:36:16 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3310148</guid><dc:creator>sheryarnizar</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3310148.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3310148</wfw:commentRss><description>&lt;p&gt;Following are the ways. to get IP Address &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;1. HttpContext&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Current.Request.ServerVariables.Get(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;REMOTE_ADDR&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;); &lt;/font&gt;&lt;/p&gt;&lt;p&gt;2. Context.Request.ServerVariables&amp;nbsp;[&amp;quot;REMOTE_ADDR&amp;quot;].ToString();&lt;/p&gt;&lt;p&gt;&lt;font color="BLACK" face="Arial"&gt;3. Request.UserHostAddress.ToString();&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="BLACK" face="Arial"&gt;4. string myHost = System.Net.Dns.GetHostName();&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="BLACK" face="Arial"&gt;Regards&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="BLACK" face="Arial"&gt;Sheryar Nizar&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3270469.aspx</link><pubDate>Thu, 02 Jul 2009 06:31:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3270469</guid><dc:creator>jaishankar2704</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3270469.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3270469</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;You can use :&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;
&lt;p&gt;HttpContext&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Current.Request.ServerVariables.Get(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;REMOTE_ADDR&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;); &lt;/font&gt;&lt;/p&gt;&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3183564.aspx</link><pubDate>Sun, 24 May 2009 04:58:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3183564</guid><dc:creator>Promas</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3183564.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3183564</wfw:commentRss><description>&lt;p&gt;Please try with this&lt;/p&gt;
&lt;p&gt;&amp;lt;%&lt;/p&gt;
&lt;p&gt;string strHostName = System.Net.Dns.GetHostName();&lt;br /&gt;string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();&lt;br /&gt;Response.Write(clientIPAddress);&lt;/p&gt;
&lt;p&gt;%&amp;gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Get users IP address</title><link>http://forums.asp.net/thread/3134763.aspx</link><pubDate>Sat, 02 May 2009 09:39:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3134763</guid><dc:creator>TATWORTH</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3134763.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=102&amp;PostID=3134763</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Try&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ipAddress = Request.UserHostAddress.ToString();&lt;/p&gt;&lt;p&gt;or if using an earlier version of the framework&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ipAddress = Request.UserHostAddress.ToString(); &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>