如何用新選項卡/新窗口打開btnSMS.PostBackUrl?或者無論如何去那個URL然後自動去另一個頁面?如何打開在新選項卡中打開鏈接?
更多信息:該URL是使用服務提供商(Clickatell)發送短信的方法。但是除了說明消息發送是否成功之外,URL沒有任何其他內容。我不希望使用我的ASP.NET的用戶卡在那裏。我想讓他們在發送消息後回到我的網站。
protected void btnSMS_Click1(object sender, EventArgs e)
{
String HP = txtHP.Text;
String URL = "http://api.clickatell.com/http/sendmsg?user=myuser&password=mypassword&api_id=myapi_id&to=";
String Text = "&text=" + txtSMS.Text;
btnSMS.PostBackUrl = URL + HP + Text;
string username;
//Sql Connection to access the database
SqlConnection conn6 = new SqlConnection("MY CONNECTION");
//Opening the Connnection
conn6.Open();
string mySQL;
username = HttpContext.Current.User.Identity.Name;
//Insert the information into the database table Login
mySQL = "INSERT INTO Table_Message(Username, Message, Title, SendTo) VALUES('" + username + "','" + txtSMS.Text.Trim() + "','" + txtTitle.Text.Trim() + "','" + txtHP.Text.Trim() + "')";
SqlCommand cmdAdd = new SqlCommand(mySQL, conn6);
//Execute the sql command
cmdAdd.ExecuteNonQuery();
//Close the Connection
}
對不起,我不明白你的意思。有沒有關於如何做到這一點的例子? – user1490374 2012-08-15 09:13:07
我更新了答案 – Madushan 2012-08-16 03:54:34