当前位置:编程学习 > C#/ASP.NET >>

●●●●●倾家荡产,各位大哥们,帮帮小弟吧●●●●●●●●●

----------------------这是界面代码----------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="telephone.aspx.cs" Inherits="telephone" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>短信</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Img/but_send.gif" OnClick="ImageButton1_Click" />
</div>
</form>
</body>
</html>
----------------------这是CS代码----------------------
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class telephone : System.Web.UI.Page
{
    string strTime;
    DataSet ds = new DataSet();
    int Telid;
    dbclass sqlcon=new dbclass();
    string strsmsuser;
    string strsmspass;
    string strsms;

    protected void Page_Load(object sender, EventArgs e)
    {
        int id = int.Parse(Request.QueryString["id"]);
         sqlcon.RunSQL("select EpDis_smsName,EpDis_smsPass,EpDis_smsContent from EpDiscountInfo where EpDis_Id='" + id + "'",ref ds,"tel");
            strsmsuser = ds.Tables["tel"].Rows[0][0].ToString();
            strsmspass = ds.Tables["tel"].Rows[0][1].ToString();
            strsms = ds.Tables["tel"].Rows[0][2].ToString();
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        dbclass sqlcon = new dbclass();
        strTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        Telid = int.Parse(Request.QueryString["id"]);
        SqlParameter[] sp = new SqlParameter[3];
        sp[0] = new SqlParameter("@txtBox1", SqlDbType.VarChar, 20);
        sp[0].Value = TextBox1.Text;
        sp[1] = new SqlParameter("@strTime", SqlDbType.VarChar, 20);
        sp[1].Value = strTime;
        sp[2] = new SqlParameter("@id", SqlDbType.Int);
        sp[2].Value = Telid;
        sqlcon.RunSQL("insert into Telephote (TelNumber,TelTime,EpDisId) values(@txtBox1,@strTime,@id)", sp);
        
        Response.Redirect("http://www.waytide.com/cgi/sms81/sendsms.asp?User=" + strsmsuser + "&Pass=" + strsmspass + "&Mobile=" + TextBox1.Text.Trim() + "&Text=" + strsms);
    }
}
-------------------------------------------------------
这里省略了部分代码strsmsuser 和strsmspass 都是从数据库提取的
-------------------------------------------------------
关键是看这段代码
Response.Redirect("http://www.waytide.com/cgi/sms81/sendsms.asp?User=" + strsmsuser + "&Pass=" + strsmspass + "&Mobile=" + TextBox1.Text.Trim() + "&Text=" + strsms);
这段代码的功能是通过这个网站用我的张号strsmsuser密码strsmspass手机号TextBox1.Text.Trim() 和短信内容strsms可以给手机发短信
但是现在执行这段代码后跳转到那个网站的界面了
http://www.waytide.com/cgi/sms81/sendsms.asp?User=张号&Pass=密码&Mobile=手机号&Text=短信内容
把我的张号密码手机号短信内容都显示在地址栏和标题栏了
虽然我把地址栏屏蔽了
但是标题栏还是会显示我的张号和密码
我现在想要的结果是执行这段代码的功能还不让它跳转到那个页面
或者是隐藏掉
让执行的人看不到
--------------------编程问答-------------------- webrequest
--------------------编程问答-------------------- mark
--------------------编程问答-------------------- 你不要Redirect过去

用webrequest发过去不就行了? --------------------编程问答-------------------- 把这些参数放在Session里,在那个页面取值 --------------------编程问答-------------------- Response.后面没这个webrequest啊 --------------------编程问答-------------------- Response.后面没这个webrequest啊
--------------------------------
汗。。。

msdn输入webrequest --------------------编程问答-------------------- 或者,先加密后解密 --------------------编程问答-------------------- mark --------------------编程问答-------------------- 自己换个模式,非要什么问号传参才行么?!表单提交难道就不行么?!
<form action="http://www.waytide.com/cgi/sms81/sendsms.asp" method="post">
....一些你的控件代码
</form>
然后通过request.form取值不就行了。在地址栏什么痕迹都不会留. --------------------编程问答-------------------- 飘过~~ --------------------编程问答-------------------- 我也飘~~~~~ --------------------编程问答-------------------- Server.Transfer --------------------编程问答-------------------- using System.Net
导入这个包,webrequest就出来了 --------------------编程问答-------------------- WebRequest.后面应该有东西吧 --------------------编程问答-------------------- 我是楼主
谁能把代码写的完善点啊
东一句西一句的
怎么让我给你分啊 --------------------编程问答-------------------- 谢谢各位大哥了 --------------------编程问答-------------------- webrequest发送数据 --------------------编程问答-------------------- 來晚了~ --------------------编程问答-------------------- Response.后面没这个webrequest啊
-----------------------------------
刚拜下风 --------------------编程问答-------------------- //把密碼這一項去掉"&Pass=" + strsmspass + 
//保留用戶名和手機號碼
Response.Redirect("http://www.waytide.com/cgi/sms81/sendsms.asp?User=" + strsmsuser + "&Mobile=" + TextBox1.Text.Trim() + "&Text=" + strsms);
Session("pass")=strsmspass;


//sendsms.asp頁面中,得到密碼。其它的參數你應該會得到吧?
string sPass = Session("pass").ToString(); --------------------编程问答-------------------- Session("pass")=strsmspass;//放在Redirect前面 --------------------编程问答-------------------- webrequest --------------------编程问答-------------------- 我是楼主
可能是我说错了
现在这个http://www.waytide.com/cgi/sms81/sendsms.asp页面不是我的
是一家短信服务商公司
我只是传4个参数过去
改不了他的页面的内容 --------------------编程问答-------------------- 你们都说webrequest这个东西
可我不会用啊
能不能把代码说的具体一点啊 --------------------编程问答-------------------- WebRequest myRequest =WebRequest.Create("http://www.waytide.com/cgi/sms81/sendsms.asp?User=" + strsmsuser + "&Pass=" + strsmspass + "&Mobile=" + TextBox1.Text.Trim() + "&Text=" + strsms);

不好使 --------------------编程问答-------------------- up --------------------编程问答-------------------- up --------------------编程问答-------------------- 为什么不加密?
使用session 
加密cookie --------------------编程问答-------------------- up --------------------编程问答-------------------- 顶 --------------------编程问答-------------------- Server.UrlEncode(strsmsuser)
--------------------编程问答-------------------- http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemnetwebrequestclasstopic.asp --------------------编程问答-------------------- 1,用 字段加密
2,用js弹出个五地址栏窗口 --------------------编程问答-------------------- 服务器地址已经变更:
新的地址为
http://sms.waytide.com/cgi/sendsms.asp
支持群发地址为
http://sms.waytide.com/cgi/sendsmsbatch.asp
参数说明
Mobile手机号码,半角分号分割多个手机号
Text短信内容
User=用户帐号
Pass=验证密码 --------------------编程问答--------------------

 WebRequest request=System.Net.WebRequest.Create("+这里使用你的url+");
        WebResponse response = request.GetResponse();


类似于这样 就可以了 --------------------编程问答--------------------
楼主的信息可以发送成功吗?

可以使用隐藏的表单提交。

<form action="你的提交地址" method="post">
<input type="hideen" name="username" value="你的用户名">
<input type="hideen" name="password" value="你的密码">
<input type="submit"  value="提交">
</form>
--------------------编程问答--------------------
引用 34 楼 waytide 的回复:
服务器地址已经变更:
新的地址为
http://sms.waytide.com/cgi/sendsms.asp
支持群发地址为
http://sms.waytide.com/cgi/sendsmsbatch.asp
参数说明
Mobile手机号码,半角分号分割多个手机号
Text短信内容
User=用户帐号
Pass=验证密码


楼主可以联系在个人。  --------------------编程问答-------------------- 把你这个换成我的
Response.Redirect( "http://www.waytide.com/cgi/sms81/sendsms.asp?User= "   +   strsmsuser   +   "&Pass= "   +   strsmspass   +   "&Mobile= "   +   TextBox1.Text.Trim()   +   "&Text= "   +   strsms); 


我写的


Response.Write("<form name='form1' method='post' action='http://www.waytide.com/cgi/sms81/sendsms.asp?'>");

Response.Write("<input type='hidden' name='User' value=" + strsmsuser + ">");
Response.Write("<input type='hidden' name='Pass' value=" + strsmspass + ">");
Response.Write("<input type='hidden' name='Mobile' value=" + TextBox1.Text.Trim() + ">");

Response.Write("<input type='hidden' name='Text' value=" + strsms + ">");
Response.Write("</form>");
Response.Write("<script>");
Response.Write("document.form1.submit()");
Response.Write("</script>");
--------------------编程问答-------------------- 。顶 --------------------编程问答-------------------- 冲这标题进来的.... --------------------编程问答-------------------- 顶一下 --------------------编程问答-------------------- 菜鸟飘过 --------------------编程问答-------------------- <%@ Language=JavaScript %>
<%

/*
' 该示范程序通过www.waytide.com发送短信
''''''''''''''''''''''''''''''''''''''''''
'返回值:
'返回值大于0表示成功,小于0表示失败。如果失败,返回信息还包括失败原因的文字描述。
'说明:
'返回成功仅表示服务器已经成功接收客户提交的任务,并不表示对方已经收到短信。
'客户提交的短信会在服务器进行排队,然户按提交顺序发送出去。
*/
var strServerURL;
var strUser,strPass, strMobile,strText;
strServerURL = "http://sms.waytide.com/cgi/";

//---------------------------------------------------------
function BytesToBstr(text ,strCharset){
        var objstream = Server.CreateObject("ADODB.Stream");
        objstream.Type = 1;
        objstream.Mode =3;
        objstream.Open();
        objstream.Write(text);
        objstream.Position = 0;
        objstream.Type = 2;
        objstream.Charset = strCharset;
        var s = objstream.ReadText(); 
        objstream.Close();
        objstream = null;
        return s;
}

//发送短信的服务器地址
function sms800(){
    var strUser=  "SMSUser";// 短信账号,由维泰分配
    var strPass=  "SMSPass";// 验证密码, 用户可自己修改
    var strMobile ="13012345678";//接收短信的手机号码
    var strText=""+Request("Text");   //短信内容(不要超过70个字)
    
    if(strUser==""){
         Response.Write("短信帐号没有设定!"); 
         return;
    }
    if(strPass==""){
         Response.Write("短信验证密码没有设定!");
         return; 
    }
    if(strMobile==""){
         Response.Write("短信接收号码没有设定!"); 
         return;
    }
    if(strText=="undefined" || strText==""){
        Response.Write("短信内容不能为空!"); 
        return;        
    }
    if(strText.length>70){
        Response.Write("短信内容不能超过70个字"); 
        return;
    }        

    var objHttp, strForm;
    //' 准备表单
    strForm = "User=" + Server.URLEncode(strUser);
    strForm = strForm + "&Pass=" + Server.URLEncode(strPass);
    strForm = strForm + "&Mobile=" + Server.URLEncode(strMobile);
    strForm = strForm + "&Text=" + Server.URLEncode(strText);
     
    var objHttp = Server.CreateObject("Microsoft.XMLHTTP")    
    
    try{
       objHttp.Open("POST", strServerURL + "sendsms.asp", false);
       objHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");       
       objHttp.send(strForm);    
    }catch (e){
        Response.Write("XMLHttp失败: " + e.description);
        return;
    }    
    var res=BytesToBstr(objHttp.responseBody,"gb2312");    
    if (objHttp.status != 200 ){
    //'HTTP 错误处理
Response.Write("短信通知发送失败,短信服务器状态="+ objHttp.status);
}
    else if (res.indexOf("成功")>=0){
//'发送成功
Response.Write("短信通知发送成功!"); 
    }
    else {
//出现错误
Response.Write("短信通知发送失败!<br>" + res);
}
    objHttp =null;    
}
%>


<html>
<head>
<title>发送短信通知</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.{line-height:1.5}
</style>
</head>
<body>
<br>
<TABLE align=center width="100%" cellSpacing=0 borderColorDark=white  borderColorLight=#8080ff
 border=1>
<TBODY>
<TR>
<TD bgColor=ivory>
<CENTER><FONT color=red><B>发送短信通知</B></FONT></CENTER></TD></TR></TBODY></TABLE>

<table align=center width="100%" border="0" cellspacing="0" cellpadding="12" >
<tr><td align=center>
<%
sms800();
%>
<br><br>

</td></tr></table>  
 

<!--|避免使用统计系统,尽量保持较快的页面运行速度|-->

</body>
</html> --------------------编程问答--------------------
好多代码啊 --------------------编程问答-------------------- LS挖坟啊~~~~~~ --------------------编程问答-------------------- 空头支票
鉴定完毕!over --------------------编程问答-------------------- 好多代码 ,看得有点眼花
--------------------编程问答-------------------- 帮顶~~~~~~~~~~~~~~~ --------------------编程问答--------------------
引用 12 楼 wpfonline 的回复:
Server.Transfer


up
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,