Data Recovery Forums - Help & Discussions Forum Index

Data Backup Software
Data Recovery Forums - Help & Discussions
Free online data recovery guide to help you find the information you need to recover your data. Discuss and get help about data recovery in this forum.
Data Recovery | RAID Recovery | Laptop Data Recovery

 FAQsFAQs   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Data Recovery Software
IP tracking in ASP.net

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Data Recovery Forums - Help & Discussions Forum Index -> .Net Technologies


 
Author Message
Warne
Guest





PostPosted: Tue Aug 15, 2006 6:11 am    Post subject: IP tracking in ASP.net Reply with quote

can we track the IP of the visitor using .net

Back to top
Isabella



Joined: 15 Jun 2006
Posts: 100

PostPosted: Wed Aug 16, 2006 3:46 am    Post subject: Reply with quote

Retrieving IP addresses

Getting the plumbing working on this project is simple: each time you make a Web request, the HTTP headers passed from the client to the Web server include information about the request, including your public Web address. That allows the Web server to respond back to the correct address. The challenge is to find a way to retrieve that header information, and return it to a client application. The answer, of course, is to create a Web service that returns the IP address of the request. This task, in fact, is amazingly simple.

The HttpRequest instance that ASP.NET makes available to you from a Web page or a Web service makes it possible to retrieve all the information you need. From within a Web page—actually within a class that inherits from System.Web.UI.Page—you can refer to Me.Request for access to this instance. In a Web service that inherits from System.Web.Services.WebService, you can use Me.Context.Request to get at the same instance. And regardless of the type of server-side code you're writing, be it a page or a service or an arbitrary handler, you can always go directly to the HttpContext.Current.Request. The HttpRequest.ServerVariables property exposes a name/value collection that contains one item for each of the well-known server variables provided by IIS and ASP.NET. Within this collection, you can retrieve the address of the requesting page, and can easily create a method that returns the value on demand.

The HttpRequest.ServerVariables collection contains all sorts of information about the current request, the client browser, the server, and more. In order to see what's in the collection, the simplest solution is to create a Web page that displays the information for you .To investigate this useful collection, create a new Web application, using either Visual Studio .NET 2003 or Visual Studio 2005. In the default page's code, simply add the following procedure:

Code:
Private Sub ListServerVariables()
    For Each key As String In Request.ServerVariables.Keys
        Response.Write(String.Format("<b>{0}</b> = {1}<br>", _
            key, Request.ServerVariables(key)))
    Next
End Sub



Finally, add code to the Page_Load event handler to call the ListServerVariables procedure.


Code:

' [b]In Visual Studio .NET 2003 or Visual Studio 2005[/b]
Dim ip As New GetIP.AddressInfo
MessageBox.Show(ip.GetAddress())

' Or in Visual Studio 2005
MessageBox.Show(My.WebServices.AddressInfo.GetAddress())





Hoping it'd help ya Smile

Back to top
View user's profile Send private message
Xprt
Guest





PostPosted: Sat Aug 26, 2006 6:32 am    Post subject: Reply with quote

Yes we can track the IP address of a visitor.

There are many ways to do this but the simplest way of tracking the IP address of visitor using .net whether you are coding in VB.net or C# is by using 'HTTPREQUEST' class. this class resides in System.web namespace.

For example:

string _IPStr;

_IPStr = Request.ServerVariables.Get("REMOTE_ADDR");

it is an overloaded Method. you can give index number or the string Key of the entry.

In this way you can get many more information about visitor.
Back to top
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Data Recovery Forums - Help & Discussions Forum Index -> .Net Technologies All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Data Recovery London UK | Data Recovery Software

Powered by phpBB © 2001, 2005 phpBB Group