Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose i am standing on abc.com and there is a link on my site of xyz.com. so whenever user click on the xyz.com it will show that he/she has requested for that url...
how can i do this by c# in asp.net
Posted
Updated 2-May-23 16:23pm
Comments
Homero Rivera 23-Nov-13 19:02pm    
Not clear enough. Is abc.com owned by you? Do you code abc.com? Or do you only own xyz.com and want to track if you came from any given site?

If you own abc.com and can code on it, you can add URL parameters and fetch them on xyz.com like xyz.com?CameFrom=abc.com . You can also add a cookie when they click on the link in abc.com and fetch the cookie instead.
If you don't own/code from abc.com, you can check the users browsing history with javascript with window.history .

Which is your scenario?
Arkadeep De 24-Nov-13 0:16am    
i own that....
Karthik_Mahalingam 26-Nov-13 11:07am    
question not clear,
please explain in details. so that we can work on that to get ur issue solved..
PDBHONGAON 5-Dec-13 0:02am    
if you want to show the destination page of the link then you can -
Use a query string.
Get HTTP POST information from the source page.
mtoha 2-May-23 22:13pm    
What kind of project? asp.net mvc? asp.net webform? What is the version of .NET?

Use This
String RequestedPage = Request.PhysicalPath.Replace(Request.PhysicalApplicationPath, "");


Might Be Helpful. I Used It For Page Wise Security In My Web Application.
 
Share this answer
 
If You are using asp.net MVC, the backend code is something like this.

public RedirectResult LogToDbRedirect()
{
   string username = HttpContext.Session.GetString("username");
  //Save to DB
  SaveToLog(username, "abc.com", "https://xyz.com" );
  return Redirect("https://xyz.com");
}



You need 1 table to save url click log, containing columns:
-id
-sourceUrl
-redirectToUrl
-username
-Timestamp
 
Share this answer
 

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