小编use*_*380的帖子

如何模拟POST请求?

我正在Windows上测试,尝试模拟POST请求(使用不同的表单变量)进行负载测试.我已经尝试了各种负载测试软件,但未能使其正常工作.

对于GET请求,我知道我可以将参数放在url后面

http://www.example.com?id=yyy&t=zzz

但是我该如何模拟POST请求呢?

我有一个Chrome REST客户端,但我不知道要在头文件和数据中添加什么.

这是我到目前为止所尝试的:

class Program
    {
        static void Main(string[] args)
        {

            string viewstateid = "/wEPDwUKLTY3NjEyMzE4NWRkK4DxZpjTmZg/RGCS2s13vkEWmwWiEE6v+XrYoWVuxeg=";
            string eventid ="/wEdAAoSjOGPZYAAeKGjkZOhQ+aKHfOfr91+YI2XVhP1c/pGR96FYSfo5JULYVvfQ61/Uw4pNGL67qcLo0vAZTfi8zd7jfuWZzOhk6V/gFA/hhJU2fx7PQKw+iST15SoB1LqJ4UpaL7786dp6laCBt9ubQNrfzeO+rrTK8MaO2KNxeFaDhrQ0hxxv9lBZnM1SHtoODXsNUYlOeO/kawcn9fX0BpWN7Brh7U3BIQTZwMNkOzIy+rv+Sj8XkEEA9HaBwlaEjg=";

            string username = "user1";
            string password = "ttee";

            string loginbutton = "Log In";

            string URLAuth = "http://localhost/login.aspx";
            string postString = string.Format("VIEWSTATE={0}&EVENTVALIDATION={1}&LoginUser_UserName={2}&LoginUser_Password={3}&LoginUser_LoginButton={4}",viewstateid,eventid, username, password,realm,otp,loginbutton);

            const string contentType = "application/x-www-form-urlencoded";
            System.Net.ServicePointManager.Expect100Continue = false;

            CookieContainer cookies = new CookieContainer();
            HttpWebRequest webRequest = WebRequest.Create(URLAuth) as HttpWebRequest;
            webRequest.Method = "POST";
            webRequest.ContentType = contentType;
            webRequest.CookieContainer = cookies;
            webRequest.ContentLength = postString.Length;
            webRequest.UserAgent = "Mozilla/5.0 (Windows; …
Run Code Online (Sandbox Code Playgroud)

http-post

27
推荐指数
3
解决办法
10万
查看次数

无法使用提供程序'RsaProtectedConfigurationProvider加密"connectionStrings"部分

无法使用提供程序'RsaProtectedCo nfigurationProvider'加密"connectionStrings"部分.来自提供程序的错误消息:对象已存在.

我按照http://msdn.microsoft.com/en-us/library/2w117ede.aspx中的指南进行操作,但是在步骤3中,为了授予对RSA密钥容器的ASP.NET身份访问权限,它说我的身份是我的workgroup\username,虽然我的web.config文件中没有模拟

我使用我的机器使用asp_regiis加密web.config,然后使用visual studio进行调试然后它出现了这个错误

aspnet-regiis.exe

25
推荐指数
1
解决办法
2万
查看次数

BufferedReader在最后一行不返回null

最后一行什么都没有,但它没有返回null.代码如下

使用调试时Eclipse,我line= ""在调试模式下看到,如何防止这种情况发生

BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
   // process the line.
}
br.close();
Run Code Online (Sandbox Code Playgroud)

java

3
推荐指数
1
解决办法
2855
查看次数

标签 统计

aspnet-regiis.exe ×1

http-post ×1

java ×1