Find IP Address in ASP.NET Behind Proxy
If you want to find the IP address of visitors to your aspx page or application or wanna retrieve IP for other uses than u need to write this code
Using this code we can find IP address of visitor even if visitor is behind any proxy
public string IpAddress()
{
string strIpAddress;
strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIpAddress == null)
{
strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
}
return strIpAddress;
}
To find IP address of a machine behind LAN you can use this code
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses
(strHostName).GetValue(1).ToString();
Find IP Address in ASP.NET Behind Proxy
Posted by
amiT jaiN
If you like this post than join us or share
Labels: C#
Subscribe to:
Post Comments (Atom)
Tags
ASP.NET
C#
GridView
VB.NET
AJAX
Sql Server
JavaScript
FindControl
EditItemTemplate
WinForms
Windows Froms
Session
Visual studio
Web.config
Authentication
ItemTemplate
DropDownList
Forms Authentication
Performance Optimization
Blogger Tricks
Crystal Reports
QueryString
SqlCommand
XML
AutoComplete Extender
BloggerTips
DetailsView
Excel
FileUpload
MembershipProvider
ObjectDataSource
DataList
IIS
LoginControl
ModalPopUpExtender
TraceMobileNumber
Update Panel
Web Service
iTextSharp
AppFabric
Cross Page Posting
DataKeyNames
jQuery
Cookies
FooterTemplate
Progress Template
Server.Transfer
Submit Form
Blog Archive
-
►
2012
(27)
-
►
February
(13)
- PrintPreviewDialog In Windows Forms DataGridView C...
- Print Printing DataGridView In WinForms C# VB.NET
- Hide Disable Commandfield Or ButtonField In GridVi...
- ExecuteNonQuery ExecuteScalar ExecuteReader Exampl...
- Read Write XML File Using C# VB.NET In Asp.Net
- Check UserName Email Availability In Asp.Net Using...
- SqlCommand ExecuteXmlReader C# VB.NET Asp.Net
- ExecuteScalar Example In Asp.Net C# VB.NET
- ExecuteReader Example Asp.Net C# VB.NET
- SqlCommand ExecuteNonQuery Example C# VB.NET Asp.N...
- Visual Studio Keyboard Shortcuts
- Asp.Net Ajax FilteredTextBox Extender Example
- Asp.Net Maintain ScrollPosition OnPostBack In Chro...
-
►
January
(14)
- Browser Detection In Asp.Net
- Export Crystal Reports To PDF Word Excel In Asp.Ne...
- Asp.Net AdRotator With Timer Example To Rotate Ads...
- Download File From Server In Asp.Net
- AspNet CompareValidator With Date Example
- Create User Registration Form In AspNet
- Visual Studio Remove Unused References With Organi...
- Get RowIndex In GridView RowCommand Event Using Da...
- Save Store Files In SqlServer Database AspNet
- Nested GridView In Asp.Net GridView Inside GridVie...
- Add License Agreement In Visual Studio Setup Proje...
- Ajax Asp.Net PasswordStrength Example
- Invalid Formatetc Structure Ajax Asp.Net Error
- Create User Programmatically Using Membership In A...
-
►
February
(13)
-
►
2011
(46)
-
►
December
(13)
- CreateUserWizard Email Verification Or Confirmatio...
- Login Page Example Using Login Control In Asp.Net
- Set Session TimeOut In Asp.Net Using WebConfig IIS...
- Remove Delete Duplicate Rows/Records From DataTabl...
- DropDownList In DetailsView EditItemTemplate
- A Potentially Dangerous Request.Form Value Was Det...
- Write Modify Web.Config Programmatically At Run Ti...
- GridView XML Edit Delete Insert Update
- Upload And Read Excel File In Asp.Net
- VisualStudio SetupProject Updates Version Already ...
- Read CSV File And Save To SQL Server In ASP.NET C#...
- GridView XMLDataSource Example
- Add Controls Dynamically WinForms WindowsFroms C# ...
-
►
December
(13)
-
▼
2008
(20)
-
▼
December
(11)
- Change Mode Of DetailsView FormView From Default M...
- Hide GridView Columns In ASP.NET
- Export GridView to Pdf-ASP.NET
- Find IP Address in ASP.NET Behind Proxy
- OpenFileDialog in winforms windows forms applicati...
- User validation authentication using session in AS...
- ASP.NET Search Records In GridView Footer And High...
- Register Dlls Assembly Custom User Controls Ascx I...
- ASP.NET TextBox Submit Form On Enter Key DefaultBu...
- Search Records In GridView And Highlight Results A...
- Detect Browser Refresh Avoid events fire in ASP.NE...
-
▼
December
(11)
Topics
- AJAX
- AppFabric
- ASP.NET
- Authentication
- AutoComplete Extender
- Blogger Tricks
- BloggerTips
- C#
- Cookies
- Cross Page Posting
- Crystal Reports
- DataKeyNames
- DataList
- DetailsView
- DropDownList
- EditItemTemplate
- Excel
- FileUpload
- FindControl
- FooterTemplate
- Forms Authentication
- GridView
- IIS
- ItemTemplate
- iTextSharp
- JavaScript
- jQuery
- LoginControl
- MembershipProvider
- ModalPopUpExtender
- ObjectDataSource
- Performance Optimization
- Progress Template
- QueryString
- Server.Transfer
- Session
- Sql Server
- SqlCommand
- Submit Form
- TraceMobileNumber
- Update Panel
- VB.NET
- Visual studio
- Web Service
- Web.config
- Windows Froms
- WinForms
- XML
Popular Posts
- Trace Mobile Number Location Operator in India
- Trace Mobile Number In India
- Ajax ModalPopUpExtender Example
- Crystal reports in ASP.NET
- FileUpload Save Images In SqlServer Database in ASP.NET
- Display Images In GridView From DataBase Asp.Net
- GridView Examples in ASP.NET 2.0 3.5
- Shopping Cart Example Code In ASP.NET GridView DataList
- Insert Update Edit Delete record in GridView
- Disable Browser Back Button Using Javascript ASP.NET

12 comments:
Hai,
Thanks for Your tips.But we can easily find the ip address using this linkwww.ip-details.com
For more details you may check
http://www.webtoolhub.com/tn561354-what-is-my-ip.aspx
Hi,
How do i use the second option:
"To find IP address of a machine behind LAN you can use this code"
inmy code behind of an aspx page?
Thanks.
Hi,
How do I use the second option in my aspx page?
Thanks
This comment has been removed by a blog administrator.
Can anyone recommend the well-priced Script Deployment software for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central malware detection
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!
System.Net.Dns.GetHostAddresses
(strHostName).GetValue(1).ToString();
How do I use the above code in my aspx page?
if i use the above code in my aspx means
Index was outside the bounds of the array.
Now what can i do? I need Dns Ip address
Hi, I use the Viusal C# Express edition. As far as I know the 2005 version that I am using is based on .Net 2.0, so it should have the System.Management namespace. However, I can't use that namespace... There is no intellisense or anything that popos up after I type it out... Do I need to have a server version of the OS to have System.Management
Thanks in advance
Shiva
i want to know the details about the ip address and client using browser and which location client open my website
Access Type (Browser),Location (IP address) [ ? ] Date/Time all these details in my website by using the c# and asp.net
tell me how to add more than 10 category
nice tutorial...
Post a Comment