473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Page works in IDE but not Compiled (VS2005)

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.

Sep 20 '07 #1
3 1331
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.
Sep 20 '07 #2
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.
Sep 20 '07 #3
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.
>
Sep 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: -DG- | last post by:
I'm told that when an VC++ 6 project is copied and compiled with the VS2005 compiler, that the runtime requires the .NET framework. I don't have any machines handy that *don't* have the framework...
5
by: Rich | last post by:
Hi, I have a project written in asp.net which has a few web pages. The project has been compiled into a dll and now I am referencing that dll in another project. How can I get one of the web...
11
by: Li Pang | last post by:
Hi, I made a web site by using asp method. Now I set up framework.net in the web server. Since to convert asp into aspx is time consuming task, I'd like to keep the web site in asp, but I want...
8
by: PJ | last post by:
How can I get a reference to the master page class? It is defined as a partial class, but I cannot seem to type a variable to the name of the partial class? The compiler continually shows "The...
3
by: jonathan.beckett | last post by:
I have been experimenting with placing user controls (using Windows Forms controls) into an ASP.NET webpage - and am completely stuck. I can get a blank user control to work, but nothing beyond...
2
by: Alec MacLean | last post by:
Hi I've just recently upgraded to VS2005 and started using/learning about the Master Pages. I'd like to know if it is possible to have separate web app projects use the master page(s) from...
6
by: Steve Richter | last post by:
what with the website solution structure not having a namespace, how does the class of one website .aspx page class reference the class of another page in the same website? I have two pages....
1
by: Bjarke | last post by:
Web application projects I have a little assignment where I have to make some changes to a Web Application Project, and there are some basic information I have spent lots of time figuring out,...
7
by: Fabio Mastria | last post by:
Looks like a joke... : As I say in the subject... I create a javascript file, with this function: function IndexChanged(source){ alert("Hallo");
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.