后台代码中使用Post进行跳转

来源:互联网 发布:梦幻西游手游mac版 编辑:程序博客网 时间:2024/06/05 18:24
页面跳转不再使用GET方式了,转而使用POST 方式代替,在后台代码中使用POST方式进行跳转,省了长长的URL ,有可以不让用者看到你传什么, 当然这个只是一个表面的工夫,要看到POST中传什么内容,还是可以的。而且有很多工具可以做到这点。

使用POST方式在后台代码中进行跳转,其实是种脚本服务端使用,就是在后台代码中加入POST 跳转的脚本和一个FORM。


WebForm1.aspx页面里:

StringBuilder sb = new StringBuilder();
            sb.Append("<form id='form' action='WebForm2.aspx' method='POST'>");
            sb.Append("<input type='hiddent' name='abc' value='上海张江高科' />");
            sb.Append("</form>");
            sb.Append("<script language='javascript'>document.getElementById('form').submit();</script>");
            Response.Write(sb.ToString());


WebForm2.aspx页面里:

Request.Form["abc"].ToString();

就能取到“上海张江高科”几个字。

原创粉丝点击