المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : HttpWebRequest and something to do with security level...



C# Programming
05-21-2009, 11:21 PM
Hi
I am trying to POST some data to a webpage by using HttpWebRequest. But the webpage tells me that my security level is too high and I should check my browser settings.

How can I solve this? It is really urgent.

My code (if you need it):
Uri adres = new Uri("http://*********/****.asp");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(adres);

request.Method = "POST";

// Taking ******s from webbrowser
request.******Container = new ******Container ();
request.******Container.Set******s(adres, webBrowser1.Document.******);

string postData = "*********************";

byte[] byteArray = Encoding.UTF8.GetBytes (postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream ();
// Write the data to the request stream.
dataStream.Write (byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close ();
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
//MessageBox.Show (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
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.
StreamWriter sr = new StreamWriter(@"C:\Users\Admin\Desktop\response.html");
sr.Write(responseFromServer);
sr.Close();
sr.Dispose();

// Clean up the streams.
reader.Close ();
dataStream.Close ();
response.Close ();



Thanks in advance.