开发者

C# - visit url in background

having a brain freeze today.

I'm looking to visit a URL to add tracking information just before my shopping cart gets redirected back to the main page (i.e. just after purchase).

I can't think how I could visit that URL without actually redirecting to my tracking开发者_开发技巧 page, and then redirecting again from there back to the homepage. Does anyone know?

This seems like it should be really easy, but I can't seem to get it working.

Thanks


Use the HttpWebClient to programattically visit a web page on the server side?

http://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.80).aspx


There are multiple ways:

  1. Put an Iframe or image tag on your homepage after being redirected from your purchase page that requests that url.
  2. Programmatically request the tracking page after purchase on your server.
  3. Make an ajax request from your homepage after being redirected (or before being redirected from your puchase page)


Are you familiar w/ JSON requests? You could hit a URL in the background (and feed it a few parameters) without actually loading a new page.


How about using javascript:

function async_url_call(url) {

    xmlHttp = GetXmlHttpObject();

    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }

    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜