<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>StreamWriter gives Error 5337</title><link>https://www.infopathdev.com:443/forums/thread/86693.aspx</link><pubDate>Mon, 04 Feb 2013 14:27:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:86693</guid><dc:creator>Bnighgrow</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/86693.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=86693</wfw:commentRss><description>&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;Hello,&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;I am having a weird issue when implementing code (VB) behind one of my Infopath 2010 forms, that I use in Browser mode for SharePoint 2010. The form that I made takes purchase information such as Credit Card CID# and other things, and then sends that information using a post to our Authorizer. The form has been working fine until Production day and after making a few cosmetic changes such as color or font size. I re-published and I get a error upon submit(Onclick within my code). Now I have seen the error before, but I am sure you would be surprised when I said over night it fixed itself. Well this time around it didn&amp;#39;t and so I started debugging and commenting out code to see when the form would spit the error. I found that it would right at this block of code below.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;p&gt;&amp;nbsp;&amp;#39; post data is sent as a stream&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myWriter &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; StreamWriter = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Nothing&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;                myWriter = &lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;New&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; StreamWriter(objRequest.GetRequestStream())&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;                myWriter.Write(post_string)&lt;/p&gt;
&lt;p&gt;                myWriter.Close()&lt;/p&gt;&lt;p&gt;Also here is the error that comes up in the Event Viewer:&lt;/p&gt;&lt;span&gt;&lt;p&gt;Exception Message: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.&lt;/p&gt;&lt;p&gt;
The remote certificate is invalid according to the validation procedure.&lt;/p&gt;&lt;p&gt;Any help to this would be appreciated.&lt;/p&gt;&lt;p&gt;Thank You,&lt;/p&gt;&lt;p&gt;Brandon&lt;/p&gt;&lt;p&gt;Update:&lt;/p&gt;&lt;p&gt;The exact line of code where the Error comes from is below:&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;myWriter = &lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;New&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; StreamWriter(objRequest.GetRequestStream())&lt;/font&gt;&lt;/p&gt;&lt;p&gt;And the objrequest comes from this block.&lt;/p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;p&gt;&amp;#39; Create HTTPWeb Request to Communicate with Authorize.Net&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; objRequest &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; HttpWebRequest = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;CType&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(WebRequest.Create(post_url), HttpWebRequest)&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;
&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;                objRequest.Method=&amp;quot;POST&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt;objRequest.ContentLength = post_string.Length&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;
objRequest.ContentType = &lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;application/x-www-form-urlencoded&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515"&gt;Thanks&lt;/font&gt;&lt;/p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;</description></item></channel></rss>