C# post表单
2010这个元旦太无聊了,于是找了个奇迹游戏私服耍,在玩的过程中发现总是要登录到网站上去转生加点之类的操作,1次2次还好,100次你就郁闷了,于是自己想写个简单的程序来做。
以下就是代码部分啦:
(需要注意的是WebClient的Cookie部分)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace ZSMU
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
client.Headers.Add("Accept", "*/*");
client.Headers.Add("Accept-Encoding", "gzip, deflate");
client.Headers.Add("Accept-Language", "zh-cn");
client.Headers.Add("Cache-Control", "no-cache");
client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//必填项目
//myWebClient.Headers.Add("Connection", "Keep-Alive");
client.Headers.Add("Referer", "http://www53.292mu.com/usezs.asp");
byte[] byteArray = Encoding.Default.GetBytes("mfkuserchr=%C2%BD%C9%CF%B5%C4%D3%E3&mfkusername=admin&mfkpassword=123456");//将提交的数据转化为byte数组
string resposeData = Encoding.Default.GetString(client.UploadData("http://www53.292mu.com/usezs.asp", "post", byteArray));
resposeData=resposeData.Remove(0, resposeData.IndexOf("alert('") + 7);
resposeData=resposeData.Remove(resposeData.IndexOf(")") - 1);
resposeData=resposeData.Replace("\\n", "");
client.Dispose();
MessageBox.Show(resposeData);
}
priv
相关文档:
在 System.Security.Cryptography 中,我们可以看到有许多类,有些类还很相似,比如:
System.Security.Cryptography.SHA1
System.Security.Cryptography.SHA1Managed
System.Security.Cryptography.SHA1CryptoServiceProvider
这三个类有什么关系呢?
SHA1
是抽象类
,SHA1Managed
和 SHA1CryptoServiceProvider ......
引用命名空间:using System.Xml
1.检查所要操作的xml文件是否存在:
System.IO.File.Exists(文件路径及名称);
2.得到xml文件:
(1)在asp.net中可以这样得到:
XmlDocument xmlDoc = new XmlDocument();
//导入xml文档
xmlDoc.Load( Server.MapPath("xmlTesting.xml"));
//导入字符串
/ ......
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中;
&n ......
<@Aattention Content="本Blog原创文章,转载或引用请注明转载"
from="Robby.cnblogs.com"@>
由于自己的搜索引擎中做到了这一块内容,所以今天说说如何抓取网页数据、分析并且去除Html标签,给大家提供一个参考。我的平台是Visual
Studio2005,C#。
& ......