cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Transact.dll removing parts of my receipt.aspx page!

I am currently trying to get my receipt.aspx page that the user is sent to by Authorize.Net after submitting their transaction. I am using the Relay Response method for this, but it seems like Authorize.Net's transact.dll page is removing certain things from my page. Specifically, and most importantly at this point in time, it is removing the script tag that accesses WebResource.axd, as well as one of the script tags that accesses ScriptResource.axd. Because of this, I am receiving errors. If I open my receipt.aspx directly (by simply entering the URL for it into the browser) and then do a view source, these things are there, so transact.dll is obviously modifying the page somehow. I thought that the page was simply retreived and displayed by transact.dll. What does transact.dll do to a page between when it retreives it and displays it, and how can I fix my problem? Thanks.

njsokalski
Contributor
5 REPLIES 5

Are they absolute path or relative path?

 

RaynorC1emen7
Expert

Both. I have tried the way they are rendered by default, which is /WebResource.axd and /ScriptResource.axd, and I have tried making them absolute, which would be http://www.mydomain.com/WebResource.axd and http://www.mydomain.com/ScriptResource.axd, but either way they were simply absent from what was sent from transact.dll. I obviously want to use the absolute, since the browser is still at Authorize.Net while the page is displayed. Does transact.dll make any changes (any changes at all) to the page it is relaying, or am I wasting my time trying to figure it out?

Is not that it is removing. It how is work. Try the following code and read the responseFromServer string. If you comment out the UserAgent, it will remove some of the javascript code.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("YOUR RECEIPT PAGE");
		request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0";
		HttpWebResponse response = (HttpWebResponse)request.GetResponse();

		Stream dataStream = response.GetResponseStream();
		// Open the stream using a StreamReader for easy access.
		StreamReader reader = new StreamReader(dataStream);
		// Read the content.
		string responseFromServer = reader.ReadToEnd();
		// Display the content.
		Console.WriteLine(responseFromServer);
		// Cleanup the streams and the response.
		reader.Close();
		dataStream.Close();
		response.Close();

 

 

OK, that's good to know. But how can I fix it? My first thought was to make a "middle-man" that uses a WebRequest with the UserAgent set to get the response from Receipt.aspx, and then writes that directly to the response. I tried this using an HttpHandler as follows:

 

Imports System.IO

Public Class ReceiptWithUA : Implements System.Web.IHttpHandler

  Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

    Dim req As HttpWebRequest = CType(WebRequest.Create("http://www.mckeepottery.com/catalog/Receipt.aspx"), HttpWebRequest)

    req.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; FunWebProducts)"

    Dim resp As HttpWebResponse = CType(req.GetResponse(), HttpWebResponse)

    Dim datastream As Stream = resp.GetResponseStream()

    Dim reader As New StreamReader(datastream)

    Dim responsefromserver As String = reader.ReadToEnd()

    context.Response.ContentType = resp.ContentType

    context.Response.Headers.Add(resp.Headers)

    context.Response.Write(responsefromserver)

    reader.Close()

    datastream.Close()

    resp.Close()

  End Sub


  ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable

    Get

      Return False

    End Get

  End Property

End Class

 

However, this did not seem to make any difference. My handler sends a UserAgent, so it's getting what I want from Receipt.aspx and then returning that to transact.dll. Since transact.dll is only directly accessing the handler, which doesn't care whether it has a UserAgent since it is not the one generating the code, shouldn't the stuff returned from Receipt.aspx to my handler be what is shown by transact.dll? Because WebResource.axd is very important for my Receipt.aspx page, I need to know how to not have it removed. Any ideas? Thanks.

The fix is just like the relay response fix. Use a javascript redirect to your receipt.aspx

So it will be

1)form1.aspx to authorize.net

2)a middle-man.aspx page the will javascript redirect, or javascript form post to

3)receipt.aspx