我创建了一个网站,我想向用户发送短信。短信被正确发送到0zeki服务器消息,但问题是它正在重定向到服务器URL,而我只想发送短信,并且没有响应重定向到服务器可以有人帮忙请
Dim con As New SqlConnection(_start)
con.Open()
Dim sql1 As String = "SELECT TOP (1) Member.PhoneNumber FROM (SELECT TOP (2) BidID, Date, BiddingPrice, Status, AuctionID, BuyerID, WinningPrice from BID ORDER BY BidID DESC) AS tabel1 INNER JOIN Buyer ON tabel1.BuyerID = Buyer.BuyerID INNER JOIN Member ON Buyer.MemberID = Member.MemberID INNER JOIN Auction ON tabel1.AuctionID = Auction.AuctionID WHERE(Auction.AuctionID = @auction) ORDER BY tabel1.BidID"
Dim auction1 As Integer = Convert.ToInt32(lblauction.Text)
Dim sqlcommand As New SqlCommand(sql1, con)
sqlcommand.Parameters.AddWithValue("@auction", auction1)
Dim phone As String = sqlcommand.ExecuteScalar
Dim sql2 As String = "SELECT Item.Name FROM Item INNER JOIN Auction ON Item.ItemID = Auction.ItemID WHERE (Auction.AuctionID = @auction)"
Dim cmd As New SqlCommand(sql2, con)
cmd.Parameters.AddWithValue("@auction", auction1)
Dim name As String = cmd.ExecuteScalar
Dim message As String = "Your bid has been overbid please, Visit the Website to bid against on auction " + name + "thanks you"
Response.Redirect("http://localhost:9333/Ozeki?login=admin&password=abc123&action=sendMessage&messagetype=SMS&recepient=" + phone + "&messageData=" + message)
答案 0 :(得分:1)
只需将Response.Redirect替换为
即可WebRequest.Create("http://localhost:9333/Ozeki?login=admin&password=abc123&action=sendMessage&messagetype=SMS&recepient=" + phone + "&messageData=" + message)
.GetResponse();
它将调用该服务并且不会重定向该页面。