SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    crossdomain xmlhttprequest + asp

    Hi,

    I have an aspx page and use xmlhttprequest to call another page "/temp/test.asp" like this.
    Code:
    var xmlHttp = false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
        xmlHttp = false;
      }
    }
    if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
      xmlHttp = new XMLHttpRequest();
    }
    
    
    var url = "/temp/test.asp";
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
    The test.asp has just one line of code
    Response.redirect("http://www.google.com");


    But the response.redirect does not work.

    Please tell me if this code should work.Else please suggest an alternative.

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to redirect to a particular page based on what your asp script designates, then simply have the ASP script respond back with the url, and have javascript read it in, and do document.location.replace() on the url you recieved back.

  3. #3
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks for the reply...

    I think I might have explained the problem in a wrong way. ..


    This code is a simple prototype of what I would like to accomplish in a more complex scenario.

    The first aspx file actually sends requests to several asp files using xmlhtprequest and uses a document.location to take the user to a different page.

    Each of these asp files inturn redirect to other crossdomain urls to kickoff some business processing. ..NO response is required from any of these crossdomain urls.

    We are doing this kind of processing since we dont want the user to be aware or wait for the background processing happening behind the first aspx file.

    Please suggest how this can be done.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •