假表单提交用C#的WebClient [英] Fake a form submission with C# WebClient

查看:162
本文介绍了假表单提交用C#的WebClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调用一个网页,并在我的asp.net MVC应用程序模型检索得到的数据。当在网络上访问时,形式如下:

I need to call a web and retrieve the resulting data from the model in my asp.net mvc application. When accessed on the web, the form looks like this:

<form id="textEntryForm" name="textEntryForm" method="post" action="/project/evaluate_to_pdf">
            <textarea id="p" rows="20" name="p" cols="132"/><br/>	
            <input type="button" value="parse" name="do_parse" onclick="new Ajax.Updater('parsedProject','/project/parse',{asynchronous:true,evalScripts:true,on404:function(e){alert('not found!')},parameters:Form.serialize(this.form)});return false"/>
            <input type="button" value="evaluate_to_html" name="do_evaluate_to_html" onclick="new Ajax.Updater('parsedProject','/project/evaluate_to_html',{asynchronous:true,evalScripts:true,on404:function(e){alert('not found!')},parameters:Form.serialize(this.form)});return false"/>
            <input type="button" value="evaluate" name="do_evaluate" onclick="new Ajax.Updater('parsedProject','/project/evaluate',{asynchronous:true,evalScripts:true,on404:function(e){alert('not found!')},parameters:Form.serialize(this.form)});return false"/>
            <input type="button" value="evaluate to pdf source" name="do_evaluate_to_pdf_source" onclick="new Ajax.Updater('parsedProject','/project/evaluate_to_pdf_source',{asynchronous:true,evalScripts:true,on404:function(e){alert('not found!')},parameters:Form.serialize(this.form)});return false"/>
            <input type="submit" id="do_evaluate_to_pdf" value="evaluate_to_pdf" name="do_evaluate_to_pdf"/>
        </form>

我需要通过将输入到textarea的ID =P的数据。如何添加在,使用Web客户端连接?

I need to pass the data that would be entered into textarea id="p". How do add that in, using a WebClient to connect?

谢谢!

修改这不是出于测试目的,我要找回我的应用程序使用的数据。

Edit This isn't for testing purposes, I need to retrieve the data for use in my application.

推荐答案

我只是用这样的:<一href=\"http://www.eggheadcafe.com/community/aspnet/2/69261/you-can-use-the-webclient.aspx\">http://www.eggheadcafe.com/community/aspnet/2/69261/you-can-use-the-webclient.aspx

这篇关于假表单提交用C#的WebClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆