Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written a code that tracks the User IP and stores it in DB so that i can use it later.


I cannot get the start ahead on how can i implement it on link click so that i get the user click data and insert it in DB as well as Do a redirection on link
Posted
Comments
TheCoolCoder 10-Oct-12 1:10am    
Please provide some code regarding exactly what you are trying to achieve. Are you asking if you can use a hyperlink and get the user IP in the server side code??

1 solution

Hi,

Write your code into the linkbuttonclick event method as given below.

in ASPX page write below code

C#
<asp:LinkButton Id="LnkBtn"  Text="Save Details" OnClick="LnkBtn_Click" runat="server"/>


and write below code in code behind file

C#
protected void LnkBtn_Click(Object sender, EventArgs e)
      {
       //user below code to get the client details
       //Request.ServerVariables["REMOTE_ADDR"];  
       //Write code to save the details into database
      }


Hope this will help you
 
Share this answer
 
v3
Comments
TheCoolCoder 10-Oct-12 2:23am    
Yeah this is what i thought too, but wasnt sure if this is what he is asking for. Include Response.Redirect(URL) too,just a suggestion, it might help him..
Kenneth Haugland 10-Oct-12 12:55pm    
From OP:
thnx that is what i wanted.......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900