|
Error
------------
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
-------------
i try to use this code
but i have error
***************
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main()
{
// Create a request for the URL.
WebRequest request = WebRequest.Create("https://isp.paltel.net/login.cfm");
// If required by the server, set the credentials.
request.PreAuthenticate = true;
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Display the status.
Console.WriteLine(response.StatusDescription);
// Get the stream containing content returned by the server.
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();
Console.Read();
}
}
}
***************
Palestine
|
|
|
|
|
Please don't re-post your question. Did you check out the
HttpWebRequest.ClientCertificates ?
Thanks,
Ben
|
|
|
|
|
Well i want to run a report for a specific record for which i have gotton help from code project but some part the that code gives Error.I am using Visualstudion.Net 2003 C#. the code is
//Instantiate variables
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
//Set instances for input parameter 1 - @vDepartment
paramField.Name = "@vDepartment";
//Below variable can be set to any data present in SalseData table, Department column
paramDiscreteValue.Value = "South";
paramField.CurrentValues.Add(paramDiscreteValue);
//Add the paramField to paramFields
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(@"..\..\..\Reports\SalseReport.rpt");
//Load the report by setting the report source
crystalReportViewer1.ReportSource = reportDocument;
the bold instructions are the errors .Actually in VS2003 we don't have obj.Name() and obj.CurrentValues.Add() functions but obj.Set_ParameterName() and Set_ParameterCurrentValues() function. when i used these instead of these,it gave me error saying that function can not be called explicitly or invalid call access operator.
waiting for everyone's solution. thank you
-- modified at 12:46 Saturday 2nd June, 2007
By Lucky Hamad
|
|
|
|
|
Hi!
i want to sort an array containing DateTime of this format: 4/5/2007 8:43:34 PM, in ascending order, i.e. latest date/time on top...
Please give any ideas about this issue...
Thanks in advance...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Probably a better method exists, you can anyhow try this.
Store the dates in binary format in an ArrayList. Do an ArrayList.Sort() and Arraylist.Reverse(); .
You can store date in binary using .ToBinary(); method and retrieve using DateTime.FromBinary(longDate) method.
|
|
|
|
|
If they are DateTime s then they will sort as stated.
If they are string s, they won't.
|
|
|
|
|
Hi,
since DateTime implements IComparable interface, you can do:
DateTime[] dt...;
Array.Sort(dt);
If it did not implement IComparable (or you want a different order), you would have
to provide a Comparer object as is:
public class DTComparer : IComparer {
public int Compare(object odt1, object odt2) {
DateTime dt1=(DateTime)odt1;
DateTime dt2=(DateTime)odt2;
long diff=dt1.Ticks-dt2.Ticks;
if (diff<0) return -1;
if (diff>0) return 1;
return 0;
}
}
public void demo() {
DateTime[] dt=new DateTime[]{
DateTime.Now.AddDays(1),
DateTime.Now.AddMinutes(1),
DateTime.Now.AddHours(1)
};
log(dt);
Array.Sort(dt, new DTComparer());
log(dt);
}
public void log(DateTime[] dta) {
log("DateTime[]:");
foreach (DateTime dt in dta) log(" "+dt.ToString());
}
|
|
|
|
|
Hello Luc,
It's allways a pleasure reading your explanation!
All the best,
Martin
|
|
|
|
|
|
Luc,
Thanks alot for the help, it solved my problem...
Looking forward for more help from you in future...
cheers!
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
I am in a small project about an application about storing, monitoring and pricing orders. I am completely in charge of the project (from analysis to tests) and I have 3 months in total to complete it (so think of about 1+ month of programming and some more weeks of fixing bugs and adding features during the test period) with 30 hours/week at most.
The company is small. The budget for new technologies is almost inexistent (they will barely afford to increase server's ram from... 128MB(!) and possibly upgrade an old win2000 machine). They want a specialised client fitted to their (quite limited) needs.
I know C# and ASP.NET (not an expert, but I do have experience in various projects). As the users will be few and non-concurrent, ASP.NET was simply not worth the effort (they are not thinking of working over internet).
I could have a simple Access database (back end) and leave to the chief manager a front end with graphs+reports on how to make his own graphs to observe whatever he wants to, and do all the rest of the application in c# clients.
But some advised me of doing everything in Access Forms. I checked this a bit more, and show that possibly Data Access Pages is a better idea. The questions are:
-are Data Access Pages going to be faster in the development? They seem so with their close integration to access, but then i fear that messing with VBScript will slow down the process (I dislike scripting languages)
-is Excel integration (as it will be helpful for pricing) in Data Access Pages strong enough to make up for the lost advanced GUI functionality I can have with WinForms?
In both cases some pretty advanced (think of DataRepeaters on drugs) functionality will be welcome if it's easily implemented.
The back end database could be used with other clients even if the company expands within reason (turning from micro to large is not even in the business plans).
--Victory, Not Vengeance
|
|
|
|
|
Ok, I suppose nobody came up with a reason to use DAP over c# :P
|
|
|
|
|
hello
i use httpwebrequest & httpwebresponse in this page
http://www.codeproject.com/cs/internet/httpeep.asp
i test this code in many site it work verrry good
but when i test this code with this site
https://isp.paltel.net/login.cfm
i have problem ???
please help me plzzzzzz
where the problem and how can solve this problem ????
Palestine
|
|
|
|
|
You don't mention at all what your problem is, so it is kind of hard to know how to help.
Are you getting an error message? An exception?
Ben
|
|
|
|
|
--------------------------------------------------------------------
TrustFailure - The underlying connection was colsed : could not estabilsh trust relashionship for SSL/TLS secure channel
--------------------------------------------------------------------
Palestine
|
|
|
|
|
Ok I missed that the second url was https:.
I haven't actually done this with a Httpwebrequest object, but looking at the documentation it looks like you need to add a client certificate.
Here is the MS help:
An application can add a certificate to a collection, but might not have access rights to it. To use a certificate contained in the collection, the application must have the same access rights as the entity that issued the certificate.
Note
The Framework caches SSL sessions as they are created and attempts to reuse a cached session for a new request, if possible. When attempting to reuse an SSL session, the Framework uses the first element of ClientCertificates (if there is one), or tries to reuse an anonymous sessions if ClientCertificates is empty.
Note
For performance reasons, you shouldn't add a client certificate to a HttpWebRequest unless you know the server will ask for it.
For a code example illustrating how to enumerate the certificates in the client certificate store, see the X509Certificate2Collection class.
Ben
|
|
|
|
|
main problem who can open untrust site with HttpWebRequest ??
Palestine
|
|
|
|
|
the see this error message
--------------------------------------------------------------------
TrustFailure - The underlying connection was colsed : could not estabilsh trust relashionship for SSL/TLS secure channel
--------------------------------------------------------------------
Palestine
|
|
|
|
|
You don't need to put the same question in multiple forums.
__________________
Bob is my homeboy.
|
|
|
|
|
I have the following interface
public interface IImage
{
string FileName { get; set;}
string Caption { get; set;}
} I have a class called Image that implements the interface.
I create a BindingList of that Image object:
BindingList<Image> images = new BindingList<Image>(); I later want to store images in a list defined as the interface.
BindingList<IImage> = images; Why am I getting a casting error? If I understand the rules of polymorphisms correctly, so long as my Image class implements IImage, I can store any Image as an IImage without needing to explicitly cast.
What to do?
-Mike.
|
|
|
|
|
MBursill wrote: BindingList<iimage> = images; // casting error
Why am I getting a casting error? If I understand the rules of polymorphisms correctly, so long as my Image class implements IImage, I can store any Image as an IImage without needing to explicitly cast.
See, as per polymorphisms you asign a object of the drived class to a base class. But in the above case the "BindingList<iimage>" is not a base class to the "BindingList", hence you are not able to assign them. Its actually the items they contains have relation of base class - drive class.
Manoj
Never Gives up
|
|
|
|
|
MBursill wrote: BindingList images = new BindingList();
Do the following
BindingList<IImage> images = new BindingList<IImage>();
|
|
|
|
|
hi,
Can you help me ?
c # directory file version and configuration version and product version as information how reader ?
I can't find
Thanks
hi
|
|
|
|
|
Hi,
1) If you want to know the Operating System Information, here is the code:
System.OperatingSystem OperatingSysInfo = System.Environment.OSVersion;
2) If you want to know the Platform, you can get it from
OperatingSysInfo.PlatForm enumrator.
similarly you can check for many information in the object of the OperatingSystem.
Manoj
Never Gives up
|
|
|
|
|
Good Morning ,
Thanks.But I want not operating system read information , I want cd , floppy disk , network , partion(C,D) whichever one (folders , file) reader (product version, file version , configuration version) information ..
Can you help me ?
Thanks .
hi
|
|
|
|