I have a strange situation. I have a website where hyperlinks are dynamically generated (as user controls) which have the target
attribute set to _blank
as I need it to open in a new window. Due to the nature of what the new page is displaying I need to audit when the user clicks on it. I already have auditing functionality set up so I am looking for a way to run code before the link opens the new page.
If it was in internal page on the same site i could simply have the hyperlink as a command button which runs the audit code and then does a Response.Redirect()
.
I don't have any control over the target pages because they are on a different website. I would be interested to her how others have done this and whether it's possible to do it in the way that I've explained!
Change your links to be a handler on your site that does the auditing and then redirects. So your links would be something like
<a href="/MyAuditingHandler.ashx?targetUrl=http://www.externalsite.com" target="_blank"></a>
Your handler audits, reads the targetUrl
parameter and then redirects.