使用WebClient自动填写并提交ASP.NET页面表单的源代码
	
    
    
	 try
    {
        // 要提交表单的URI字符串。
        string uriString = "http://localhost:1165/WebTest/MyLogin.aspx";
        ///////////////////////////////////////
        // 打开页面
        ///////////////////////////////////////
        WebClient webClient = new WebClient();
        byte[] responseData = webClient.DownloadData(uriString);
        string srcString = Encoding.UTF8.GetString(responseData);
        ///////////////////////////////////////
        // 填写页面并提交
        ///////////////////////////////////////
        webClient = new WebClient();
        webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
        // 获取页面的 VeiwState                
        string viewStateFlag = "id=\"__VIEWSTATE\" value=\"";
        int i = srcString.IndexOf(viewStateFlag) + viewStateFlag.Length;
        int j = srcString.IndexOf("\"",i);
        string viewState = srcString.Substring(i, j-i);
    &nb
    
     
	
	
    
    
	相关文档:
        
    
       Beyond File | New Company: from Cheesy Sample to Social Platform         Scott Hanselman in Lagoon L on Monday at 11:30 AM        The web has changed and there's a new way of thinking about your applications. You can't just write some HTML and CSS anymore and expect to be the next Twitter. Hear h ......
	
    
        
    
    在
vs2008为asp.net ajax添加js智能感知
	
		
			
今天找了好久,终于搞清楚了,scriptManager控件支持js智能感知,而从其继承的toolkitScriptManager不支持。至少在
vs2008b2中是这样。
要在js文件中添加asp.net ajax的js智能感知(与scriptManager控件无关),在js文件的开头添加这样一行即可:
//
/<referen ......
	
    
        
    
    最近在看《asp.net通用模块及典型系统开发实例导航》,其中用到了MD5加密,代码如下:    /// <summary>
        /// 字符串加密函数
        /// </summary>
        /// <param name="strInput">输入被加密的字符串</param>
        /// <returns>加密后的字符串</return ......
	
    
        
    
    
使用WebClient自动填写并提交ASP.NET页面表单
      在.NET中通过程序填写和提交表单还是比较简单。比如,要提交一个如下图所示的登录表单:
           
填写和提交以上表单的代码如下:
      &nb ......