Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page works in IDE but not Compiled (VS2005)

Reply
Thread Tools

Page works in IDE but not Compiled (VS2005)

 
 
=?Utf-8?B?RG91Z1Q=?=
Guest
Posts: n/a
 
      09-20-2007
I have a web page that is using a certificate to interact with another web
site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
If I do a Build/Publish Web Site it doesn't work. I get a "The request was
aborted: Could not create SSL/TLS secure channel." The statement appears
after I perform a datastream = oWebreq.GetRequestStream.

My code looks like the following:
sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
oWebreq = Net.HttpWebRequest.Create(sDSXURL)

oWebreq.ClientCertificates.Add(oCert)
oWebreq.CookieContainer = New Net.CookieContainer
oWebreq.Method = "POST"
oWebreq.AllowWriteStreamBuffering = False
oWebreq.MaximumAutomaticRedirections = 1
oWebreq.AllowAutoRedirect = False
oWebreq.ContentLength = sXml.Length
oWebreq.ContentType = "application/x-www-form-urlencoded"
Try
datastream = oWebreq.GetRequestStream
datastream.Write(System.Text.Encoding.UTF8.GetByte s(sXml),
0, oWebreq.ContentLength)
datastream.Flush()
datastream.Close()
oWebres = oWebreq.GetResponse
Catch ex As Exception
Response.Write(CONFIGPROBLEM & ex.Message)
Exit Sub
End Try

However, it appears something with the certificate, since I have used other
certificates in the code above without problems.

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      09-20-2007
most likely the server you are requesting has an expired certificate,
which causes the servicepoint manger to rejection the connection. you
can supply your own verification routine. See:

ServicePointManager.ServerCertificateValidationCal lback


-- bruce (sqlwork.com)

DougT wrote:
> I have a web page that is using a certificate to interact with another web
> site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
> If I do a Build/Publish Web Site it doesn't work. I get a "The request was
> aborted: Could not create SSL/TLS secure channel." The statement appears
> after I perform a datastream = oWebreq.GetRequestStream.
>
> My code looks like the following:
> sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
> oWebreq = Net.HttpWebRequest.Create(sDSXURL)
>
> oWebreq.ClientCertificates.Add(oCert)
> oWebreq.CookieContainer = New Net.CookieContainer
> oWebreq.Method = "POST"
> oWebreq.AllowWriteStreamBuffering = False
> oWebreq.MaximumAutomaticRedirections = 1
> oWebreq.AllowAutoRedirect = False
> oWebreq.ContentLength = sXml.Length
> oWebreq.ContentType = "application/x-www-form-urlencoded"
> Try
> datastream = oWebreq.GetRequestStream
> datastream.Write(System.Text.Encoding.UTF8.GetByte s(sXml),
> 0, oWebreq.ContentLength)
> datastream.Flush()
> datastream.Close()
> oWebres = oWebreq.GetResponse
> Catch ex As Exception
> Response.Write(CONFIGPROBLEM & ex.Message)
> Exit Sub
> End Try
>
> However, it appears something with the certificate, since I have used other
> certificates in the code above without problems.
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RG91Z1Q=?=
Guest
Posts: n/a
 
      09-20-2007
If it was expired why does it work in the VS2005 IDE. I can take that same
certificate export it to a PFX with a password, use that new certificate in
the store and that works.

"bruce barker" wrote:

> most likely the server you are requesting has an expired certificate,
> which causes the servicepoint manger to rejection the connection. you
> can supply your own verification routine. See:
>
> ServicePointManager.ServerCertificateValidationCal lback
>
>
> -- bruce (sqlwork.com)
>
> DougT wrote:
> > I have a web page that is using a certificate to interact with another web
> > site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
> > If I do a Build/Publish Web Site it doesn't work. I get a "The request was
> > aborted: Could not create SSL/TLS secure channel." The statement appears
> > after I perform a datastream = oWebreq.GetRequestStream.
> >
> > My code looks like the following:
> > sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
> > oWebreq = Net.HttpWebRequest.Create(sDSXURL)
> >
> > oWebreq.ClientCertificates.Add(oCert)
> > oWebreq.CookieContainer = New Net.CookieContainer
> > oWebreq.Method = "POST"
> > oWebreq.AllowWriteStreamBuffering = False
> > oWebreq.MaximumAutomaticRedirections = 1
> > oWebreq.AllowAutoRedirect = False
> > oWebreq.ContentLength = sXml.Length
> > oWebreq.ContentType = "application/x-www-form-urlencoded"
> > Try
> > datastream = oWebreq.GetRequestStream
> > datastream.Write(System.Text.Encoding.UTF8.GetByte s(sXml),
> > 0, oWebreq.ContentLength)
> > datastream.Flush()
> > datastream.Close()
> > oWebres = oWebreq.GetResponse
> > Catch ex As Exception
> > Response.Write(CONFIGPROBLEM & ex.Message)
> > Exit Sub
> > End Try
> >
> > However, it appears something with the certificate, since I have used other
> > certificates in the code above without problems.
> >

>

 
Reply With Quote
 
=?Utf-8?B?RG91Z1Q=?=
Guest
Posts: n/a
 
      09-24-2007
Found the problem. WHen exporting the original certificate a password was not
supplied when request strong encryption. By exporting again and supplying a
password it now works in IDE and runtime.

"DougT" wrote:

> If it was expired why does it work in the VS2005 IDE. I can take that same
> certificate export it to a PFX with a password, use that new certificate in
> the store and that works.
>
> "bruce barker" wrote:
>
> > most likely the server you are requesting has an expired certificate,
> > which causes the servicepoint manger to rejection the connection. you
> > can supply your own verification routine. See:
> >
> > ServicePointManager.ServerCertificateValidationCal lback
> >
> >
> > -- bruce (sqlwork.com)
> >
> > DougT wrote:
> > > I have a web page that is using a certificate to interact with another web
> > > site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
> > > If I do a Build/Publish Web Site it doesn't work. I get a "The request was
> > > aborted: Could not create SSL/TLS secure channel." The statement appears
> > > after I perform a datastream = oWebreq.GetRequestStream.
> > >
> > > My code looks like the following:
> > > sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
> > > oWebreq = Net.HttpWebRequest.Create(sDSXURL)
> > >
> > > oWebreq.ClientCertificates.Add(oCert)
> > > oWebreq.CookieContainer = New Net.CookieContainer
> > > oWebreq.Method = "POST"
> > > oWebreq.AllowWriteStreamBuffering = False
> > > oWebreq.MaximumAutomaticRedirections = 1
> > > oWebreq.AllowAutoRedirect = False
> > > oWebreq.ContentLength = sXml.Length
> > > oWebreq.ContentType = "application/x-www-form-urlencoded"
> > > Try
> > > datastream = oWebreq.GetRequestStream
> > > datastream.Write(System.Text.Encoding.UTF8.GetByte s(sXml),
> > > 0, oWebreq.ContentLength)
> > > datastream.Flush()
> > > datastream.Close()
> > > oWebres = oWebreq.GetResponse
> > > Catch ex As Exception
> > > Response.Write(CONFIGPROBLEM & ex.Message)
> > > Exit Sub
> > > End Try
> > >
> > > However, it appears something with the certificate, since I have used other
> > > certificates in the code above without problems.
> > >

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I create a page, then it's compiled upon first request, where cani find the compiled code?? lander ASP .Net 5 03-05-2008 04:34 PM
Newbie Question: Code works when compiled as .exe but not as function... philbo30 C Programming 5 02-17-2007 05:35 PM
g++ compiled C++ code called from gcc compiled C code Klaus Schneider C++ 1 12-02-2004 01:44 PM
[py2exe.i18n] English works, German works, but not French. What do I miss? F. GEIGER Python 3 08-06-2004 10:01 AM
After rebooting my PC works, works, works! Antivirus problem? Adriano Computer Information 1 12-15-2003 05:30 AM



Advertisments