By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,703 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,703 IT Pros & Developers. It's quick & easy.

having trouble sending a post in asp.net using C#

P: n/a
here is my code that i am using to send the post to
verisign:
using System.Drawing;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;
using System.Collections;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Text;
using System.Web;

public class MyCodeBehind : Page{
public TextBox login, partner, type, amount, user1;
public Button send;

public void send_Click(object sender, EventArgs e){
string login_s = login.Text;
string partner_s = partner.Text;
string type_s = type.Text;
string amount_s = amount.Text;
string user1_s = user1.Text;

ASCIIEncoding encoding=new ASCIIEncoding();
string postData="Login="+login_s;
postData += ("&partner="+partner_s);
postData += ("&type="+type_s);
postData += ("&amount="+amount_s);
postData += ("&user1="+user1_s);
byte[] data = encoding.GetBytes(postData);

// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)
WebRequest.Create
("https://payflowlink.verisign.com/payflowlink.cfm");
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-
urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
}
}
and i am getting the follwing error message:
Server Error in '/' Application.
-----------------------------------------------------------
---------------------

The operation has timed-out.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Net.WebException: The operation
has timed-out.

Source Error:(line 45 is in red color, meaning the error
is in that line)
Line 43: myRequest.ContentType="application/x-www-
form-urlencoded";
Line 44: myRequest.ContentLength = data.Length;
Line 45: Stream newStream=myRequest.GetRequestStream
();
Line 46: // Send the data.
Line 47: newStream.Write(data,0,data.Length);
Source File:
D:\root\fitfreak\trainwithdom.com\www\launch.cs Line:
45

Stack Trace:
[WebException: The operation has timed-out.]
System.Net.HttpWebRequest.GetRequestStream() +190
MyCodeBehind.send_Click(Object sender, EventArgs e) in
D:\root\fitfreak\trainwithdom.com\www\launch.cs:45
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEve
ntHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

-------------------------------
Can some please help, I will appriciate it highly
thanks

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.