易截截图软件、单文件、免安装、纯绿色、仅160KB

使用WebClient自动填写并提交ASP.NET页面表单


使用WebClient自动填写并提交ASP.NET页面表单
      在.NET中通过程序填写和提交表单还是比较简单。比如,要提交一个如下图所示的登录表单:
           
填写和提交以上表单的代码如下:
       // 要提交表单的URI字符串。
       string uriString = "http://www.xxx.com/Login.aspx";
       // 要提交的字符串数据。
       string postString = "userName=user1&password=password1";
       // 初始化WebClient
       WebClient webClient = new WebClient();
       webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
       // 将字符串转换成字节数组
       byte[] postData = Encoding.ASCII.GetBytes(postString);
       // 上传数据,返回页面的字节数组
       byte[] responseData = webClient.UploadData(uriString, "POST", postData);
       // 返回的将字节数组转换成字符串(HTML)
       string srcString = Encoding.UTF8.GetString(responseData);
srcStrinig 就是提交表单后所返回页面的HTML。怎么样,很简单吧。
      但是,以上代码可以提交ASP或JSP生成的表单,却不能提交ASP.NET表单。因为提交ASP.NET表单时,必须给“__VIEWSTATE”和“__EVENTVALIDATION”赋值。“__VIEWSTATE”和“__EVENTVALIDATION”的值可以通过在要提交的页面上按右键“查看源文件”中找到。如下:
        id="__VIEWSTATE" value="/wEPDwUKM


相关文档:

ASP.NET中解决传递中文参数

1.设置web.config文件.
<system.web>
......
<globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" />
......
</system.web>
 
或者:
aspx文件中:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"&g ......

C# asp.net如何使用MD5加密,解密

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;namespace md5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(UserMd5("8"));
Console.WriteLine(GetMd5Str("8"));
}
/**//// &lt;summary&gt;
/// MD5 16位加密 ......

google suggest 下拉菜单(asp.net/jQuery版本)

suggest.js文件(在引入suggest.js文件前需要先引入jquery-1.4.2.min.js):
 $(function() {
var k = -1;
//给查询文本框绑定click keyup事件,进行这两个事件,自动查询数据
$("#FrmChangshang").bind('click keyup', function(event) {
//获取键盘操作事件代码
var keyc = event ......

ASP转ASP.NET(1)

      与ASP相比,ASP.NET在很多方面有了显著的改进,这些方面包括:性能、状态管理、可缩放性、配置、部署、安全性、输出缓存控制、网络场支持和XML Web services结构等。   
      如果您具有ASP   开发技能,则新的   ASP.NET   编程 ......

Online active users counter in ASP.NET


Online active users counter in ASP.NET
With this tool which is written for ASP.NET, it is possible to count the number of online users, members and guest users in web sites.
Installation
The tool installation is very simple and only takes a few minutes.
Step one - Add Reference:
After downlo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号