Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stephanie 31 posts 93 karma points
    Jan 05, 2012 @ 16:55
    Stephanie
    0

    IE dying on request.GetResponse()

    I'm having an issue where the following code is working perfect in Chrome and FF but is dying on the bold/italic line in IE.  No error is thrown that I can tell, I have a try catch block that is printing to a text file any errors that are thrown.  This is a custom workflow for contour that adds a new contact to Constant Contact. The address variable is "https://api.constantcontact.com/ws/customers/[username]/contacts.  The contentType is "application/atom+xml".  The requestMethod is "POST".  The data is XML as shown below the code.  One thing I feel I should mention is that the username is an email address.  I'm assuming that this should be URL encoded. 

     

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
                request.Credentials = CreateCredentialCache(address, authenticationData);
                request.Method = requestMethod;
                request.ContentType = contentType;
                request.PreAuthenticate = true;
                request.ContentLength = data.Length;
                Stream stream = request.GetRequestStream();
                stream.Write(data, 0, data.Length);
                Stream responseStream = Stream.Null;
                try
                {
     HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    Console.WriteLine(String.Format(CultureInfo.InvariantCulture,
                                                    "Method {0}, response description: {1}", request.Method,
                                                    response.StatusDescription));
    
                    if (response.StatusCode == HttpStatusCode.NoContent)
                    {
                        return Stream.Null;
                    }
                    responseStream = response.GetResponseStream();
                    MemoryStream memoryStream = ReadResponseStream(responseStream);
                    return memoryStream;
                }
                catch (Exception ex)
                {
                    Logging.LogError("GetResponseStream: " + ex.Message);
                }
                finally
                {
                    stream.Close();
                    responseStream.Close();
                }
                return Stream.Null;
    <entry xmlns="http://www.w3.org/2005/Atom">
        <title type="text"></title>
        <updated>2008-07-23T14:21:06.407Z</updated>
        <author></author>
        <id>data:,none</id>
        <summary type="text">Contact</summary>
        <content type="application/vnd.ctct+xml">
            <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
                <EmailAddress>[email protected]</EmailAddress>
                <FirstName>s</FirstName>
                <MiddleName></MiddleName>
                <LastName>j</LastName>
                <HomePhone>7</HomePhone>
                <Addr1></Addr1>
                <Addr2></Addr2>
                <Addr3></Addr3>
                <City></City>
                <StateCode></StateCode>
                <StateName></StateName>
                <PostalCode></PostalCode>
                <SubPostalCode></SubPostalCode>
                <CountryCode></CountryCode>
                <CompanyName>m</CompanyName>
                <JobTitle>i</JobTitle>
                <WorkPhone></WorkPhone>
                <EmailType>HTML</EmailType>
                <OptInSource>ACTION_BY_CONTACT</OptInSource>
                <Note></Note>
                <CustomField1></CustomField1>
                <CustomField2></CustomField2>
                <CustomField3></CustomField3>
                <CustomField4></CustomField4>
                <CustomField5></CustomField5>
                <CustomField6></CustomField6>
                <CustomField7></CustomField7>
                <CustomField8></CustomField8>
                <CustomField9></CustomField9>
                <CustomField10></CustomField10>
                <CustomField11></CustomField11>
                <CustomField12></CustomField12>
                <CustomField13></CustomField13>
                <CustomField14></CustomField14>
                <CustomField15></CustomField15>
                <ContactLists>
                    <ContactList id="https://api.constantcontact.com/ws/customers/[username]/lists/37"/>
                    <ContactList id="https://api.constantcontact.com/ws/customers/[username]/lists/39"/>
                </ContactLists>
            </Contact>
        </content>
    </entry>
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies