Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: datagrid control Pin
Paul Conrad4-Nov-07 5:03
professionalPaul Conrad4-Nov-07 5:03 
QuestionImage Into Oracle!!!! Pin
push19884-Nov-07 0:05
push19884-Nov-07 0:05 
AnswerRe: Image Into Oracle!!!! Pin
enjoycrack4-Nov-07 3:38
enjoycrack4-Nov-07 3:38 
GeneralRe: Image Into Oracle!!!! Pin
push19884-Nov-07 18:13
push19884-Nov-07 18:13 
QuestionDelete row from gridview after bind Pin
playout3-Nov-07 22:20
playout3-Nov-07 22:20 
AnswerRe: Delete row from gridview after bind Pin
jaysaran4-Nov-07 23:11
jaysaran4-Nov-07 23:11 
QuestionGridView Bound values Pin
Amr M. K.3-Nov-07 22:08
Amr M. K.3-Nov-07 22:08 
Questionhow can send and recive data to a web page? Pin
B.A3-Nov-07 22:00
B.A3-Nov-07 22:00 
hi

i use of WebRequest.BeginGetRequestStream method such as follow , to send and get data to a site (for example to one of my web page application ) programmetically.

my problem is these code doesn't work correctly.
i think , problem is in set parameter.

can you guide me?


protected void btn_BeginGetRequestStream_Click(object sender, EventArgs e)
{
// Create a new HttpWebRequest object.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(TextBox1.Text);

// Set the ContentType property.
request.ContentType = "application/x-www-form-urlencoded";
// Set the Method property to 'POST' to post data to the URI.
request.Method = "POST";
// Start the asynchronous operation.
request.BeginGetRequestStream(new AsyncCallback(ReadCallback), request);

// Keep the main thread from continuing while the asynchronous
// operation completes. A real world application
// could do something useful such as updating its user interface.
allDone.WaitOne();

// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
string responseString = streamRead.ReadToEnd();
TextBox4.Text = responseString;
// Close the stream object.
streamResponse.Close();
streamRead.Close();

// Release the HttpWebResponse.
response.Close();

}

public static ManualResetEvent allDone = new ManualResetEvent(false);

private static void ReadCallback(IAsyncResult asynchronousResult)
{
HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
// End the operation.
Stream postStream = request.EndGetRequestStream(asynchronousResult);
//Console.WriteLine("Please enter the input data to be posted:");
string postData = "Text1=" + "hi";

// Convert the string into a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
// Write to the request stream.
postStream.Write(byteArray, 0, postData.Length);
postStream.Close();
allDone.Set();
}






tanks Rose | [Rose]
AnswerRe: Sample Code Example Pin
Christian Graus3-Nov-07 21:40
protectorChristian Graus3-Nov-07 21:40 
Generalapologise Pin
B.A4-Nov-07 3:05
B.A4-Nov-07 3:05 
GeneralRe: my question is joke ! Pin
John-ph4-Nov-07 3:29
John-ph4-Nov-07 3:29 
GeneralRe: my question is joke ! Pin
Paul Conrad4-Nov-07 5:06
professionalPaul Conrad4-Nov-07 5:06 
GeneralRe: my question is joke ! Pin
pmarfleet4-Nov-07 5:08
pmarfleet4-Nov-07 5:08 
QuestionNeed Advice (Atlas or AJAX) Pin
Ahmad Adnan3-Nov-07 20:23
Ahmad Adnan3-Nov-07 20:23 
AnswerRe: Need Advice (Atlas or AJAX) Pin
Christian Graus3-Nov-07 21:39
protectorChristian Graus3-Nov-07 21:39 
QuestionGridView (A to Z)+Sourabh Pin
Dot Net Jantu3-Nov-07 20:20
Dot Net Jantu3-Nov-07 20:20 
AnswerGridView (A to Z)+Sourabh Pin
Sarani Ravindran4-Nov-07 20:01
Sarani Ravindran4-Nov-07 20:01 
Questioncreate subdomail automatically by programming??? Pin
mr.mohsen3-Nov-07 20:08
mr.mohsen3-Nov-07 20:08 
AnswerRe: create subdomail automatically by programming??? Pin
Michael Sync7-Nov-07 5:45
Michael Sync7-Nov-07 5:45 
Questionasp.net with vb.net Pin
rakeshreddyperati3-Nov-07 19:43
rakeshreddyperati3-Nov-07 19:43 
AnswerRe: asp.net with vb.net Pin
Christian Graus3-Nov-07 20:22
protectorChristian Graus3-Nov-07 20:22 
Questionlocalize menu control in ASP.net 2.0 Pin
Rajesh_K_Sharma3-Nov-07 19:12
Rajesh_K_Sharma3-Nov-07 19:12 
QuestionError with ASP.NET 2.0 Pin
nickabradley3-Nov-07 10:26
nickabradley3-Nov-07 10:26 
AnswerRe: Error with ASP.NET 2.0 Pin
pmarfleet3-Nov-07 11:00
pmarfleet3-Nov-07 11:00 
GeneralRe: Error with ASP.NET 2.0 Pin
nickabradley3-Nov-07 12:00
nickabradley3-Nov-07 12:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.