提取访问者机器的IP并将其存储 [英] Fetch Ip of Visitor's Machine and store it
本文介绍了提取访问者机器的IP并将其存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的开发人员,
我是孟买的Web开发人员.我为我们的公司创建了一个网站,即. www.onkarelearnings.com,我想获取并显示访问我们网站并将其存储在数据库中的IP地址.仅出于安全原因.
它只需要C#和SQL.因此,请帮助我解决我的问题.
请给我发送详细的代码.
谢谢您.
Dear Developer,
I am a Web Developer in Mumbai. I created a website for our company ie. www.onkarelearnings.com and i want to fetch and show the IP ADdress who visit our website and store it in database. only for security reason.
All it wants in C# and SQL. So please help me to sortout my problem.
Please send me detailed code for that.
Thanks in advanced.
推荐答案
获取访问者的IP很简单:只需使用 ^ ]
大概您知道如何向数据库添加记录:只需创建一个具有足够空间来容纳IP地址的字段
Getting the visitor''s IP is simple: just use the HttpContext.Current.Request.UserHostAddress[^]
Presumably you know how to add records to a database: just create a field with enough space to hold the IP address
查看此链接
链接1 [ ^ ]
代码项目的链接
Link2 [ Link3 [
See this links
Link 1[^]
Code project''s link
Link2[^]
Link3[^]
为此,您要使用 Request.UserHostAddress .这是访问者IP地址的属性
MSDN: MSDN参考 [
For this you want to use Request.UserHostAddress. This is a property of the visitors IP address
MSDN: MSDN Reference[^]
Please mark as answered if this helps you!!!
这篇关于提取访问者机器的IP并将其存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文