I'm constructing an ASP page that I'd like to test by writing a program that
simulates "many" users hitting the submit button on a form. I assume it's
possible to manually construct an httprequest object, but the docs are more
oriented towards using one that already exists. Am I on the right track or
is there an easier way?
In my case the Form to be submitted has a couple of hundred fields and what
I want to do is access a database with "answers" to use for filling in these
fields. I can then validate the results by comparing the source database
against what my ASP app creates.
Thanks for any suggestions/pointers...
Bill 19 2098
The class that you want to look at is WebClient, specifically the
UploadValues method.
There may be automated tools that will simplify what you're trying to do.
"Bill Cohagan" wrote: I'm constructing an ASP page that I'd like to test by writing a program that simulates "many" users hitting the submit button on a form. I assume it's possible to manually construct an httprequest object, but the docs are more oriented towards using one that already exists. Am I on the right track or is there an easier way?
In my case the Form to be submitted has a couple of hundred fields and what I want to do is access a database with "answers" to use for filling in these fields. I can then validate the results by comparing the source database against what my ASP app creates.
Thanks for any suggestions/pointers...
Bill
Bill Cohagan wrote: I'm constructing an ASP page that I'd like to test by writing a program that simulates "many" users hitting the submit button on a form. I assume it's possible to manually construct an httprequest object, but the docs are more oriented towards using one that already exists. Am I on the right track or is there an easier way?
In my case the Form to be submitted has a couple of hundred fields and what I want to do is access a database with "answers" to use for filling in these fields. I can then validate the results by comparing the source database against what my ASP app creates.
Thanks for any suggestions/pointers...
System.Web.Http Request is a server-side class. To create your own HTTP
requests, you'll want to use System.Net.Http WebRequest. The system you're
building reminds me of FIT --
see http://fit.c2.com/wiki.cgi?WhatsWhat.
Cheers,
--
Joerg Jooss jo*********@gmx .net
Thanks to all for the quick and useful responses!
Bill
"Bill Cohagan" <bi**@teraXNOSP AMXquest.com> wrote in message
news:Ou******** ******@TK2MSFTN GP10.phx.gbl... I'm constructing an ASP page that I'd like to test by writing a program
that simulates "many" users hitting the submit button on a form. I assume it's possible to manually construct an httprequest object, but the docs are
more oriented towards using one that already exists. Am I on the right track or is there an easier way?
In my case the Form to be submitted has a couple of hundred fields and
what I want to do is access a database with "answers" to use for filling in
these fields. I can then validate the results by comparing the source database against what my ASP app creates.
Thanks for any suggestions/pointers...
Bill
Steven
I've constructed a WebRequest class in c# based on these articles, but am
experiencing an error (500) Internal Server Error. Following I'm including
the constructor and the Post method code:
=============== =====
public WebRequest(stri ng url)
{
req = (HttpWebRequest )System.Net.Web Request.Create( url);
req.Method = "POST";
req.ContentType = "applicatio n/x-www-form-urlencoded";
}
public string Post()
{
req.ContentLeng th = post.Length;
using(StreamWri ter myWriter = new StreamWriter(re q.GetRequestStr eam()))
{
myWriter.Write( post);
}
HttpWebResponse res = (HttpWebRespons e)req.GetRespon se();
using (StreamReader sr = new StreamReader(re s.GetResponseSt ream()) )
{
return sr.ReadToEnd();
}
}
=============== =============== =============== =
The error is thrown on the call to req.GetResponse ().
The url I'm passing in the constructor is http://localhost/QW/spike1.aspx
which is the correct url for the page under test. I've tried several
different values in the post string, including string.Empty, and always get
the same error. The _status property of the request indicates a protocol
error, but beyond that I'm not sure how to proceed. Any suggestions as to
how I might debug this?
Thanks
Bill
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:c%******** ********@cpmsft ngxa06.phx.gbl. .. Hi Bill,
As for using the HttpWebRequest, here ar e some tech articles :
#Test Automation for ASP.NET Web Apps with SSL http://msdn.microsoft.com/msdnmag/is...n/default.aspx
#POSTing Data with ASP.NET http://authors.aspalliance.com/steve...netscrape2.asp
Hope also helps.
Regards,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
Get Preview at ASP.NET whidbey http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Bill:
In my experience, nine times out of ten this is caused by incorrect
POST data. You might need to UrlEncode the data, or might not have the
right content length, something along those lines.
One of the best ways to debug this is to use a tool like Fiddler. http://www.fiddlertool.com/fiddler/
What you do is record what your browser sends to the server if you do
the POST manually. Then record what your sofrware sends. Then compare
the two and see what is different.
I have an article here that may offer some insight too:
Screen Scraping, ViewState, and Authentication using ASP.Net http://odetocode.com/Articles/162.aspx
Hope this helps,
--
Scott http://www.OdeToCode.com
On Fri, 13 Aug 2004 17:42:39 -0500, "Bill Cohagan"
<bi**@teraXNOSP AMXquest.com> wrote: Steven I've constructed a WebRequest class in c# based on these articles, but am experiencing an error (500) Internal Server Error. Following I'm including the constructor and the Post method code: ============== ======
Scott-
Thanks for the response and suggestions. I downloaded and installed
fiddler and it works fine for a browser induced POST, but absolutely nothing
is captured when I try my program. I have included the suggested
GlobalProxySele ction.Select code as well.
Any ideas/suggestions?
Thanks again,
Bill
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4f******** *************** *********@4ax.c om... Hi Bill:
In my experience, nine times out of ten this is caused by incorrect POST data. You might need to UrlEncode the data, or might not have the right content length, something along those lines.
One of the best ways to debug this is to use a tool like Fiddler. http://www.fiddlertool.com/fiddler/
What you do is record what your browser sends to the server if you do the POST manually. Then record what your sofrware sends. Then compare the two and see what is different.
I have an article here that may offer some insight too:
Screen Scraping, ViewState, and Authentication using ASP.Net http://odetocode.com/Articles/162.aspx
Hope this helps,
-- Scott http://www.OdeToCode.com
On Fri, 13 Aug 2004 17:42:39 -0500, "Bill Cohagan" <bi**@teraXNOSP AMXquest.com> wrote:
Steven I've constructed a WebRequest class in c# based on these articles, but
amexperiencing an error (500) Internal Server Error. Following I'm
includingthe constructor and the Post method code: ============== ======
Hi Bill:
I'm sorry I don't have a good suggestion (I've seen it work,
really!!).
Perhaps restarting IIS after Fiddler has started? Seems hackish but I
can't think of anything at the moment....
--
Scott http://www.OdeToCode.com
On Fri, 13 Aug 2004 20:20:32 -0500, "Bill Cohagan"
<bi**@teraXNOSP AMXquest.com> wrote: Scott- Thanks for the response and suggestions. I downloaded and installed fiddler and it works fine for a browser induced POST, but absolutely nothing is captured when I try my program. I have included the suggested GlobalProxySel ection.Select code as well.
Any ideas/suggestions?
Bill Cohagan wrote: Steven I've constructed a WebRequest class in c# based on these articles, but am experiencing an error (500) Internal Server Error. Following I'm including the constructor and the Post method code: =============== ===== public WebRequest(stri ng url) { req = (HttpWebRequest )System.Net.Web Request.Create( url); req.Method = "POST"; req.ContentType = "applicatio n/x-www-form-urlencoded"; }
public string Post() { req.ContentLeng th = post.Length;
First law of proper character string processing: String length in general
does not equal byte length.
Because...
using(StreamWri ter myWriter = new StreamWriter(re q.GetRequestStr eam())) { myWriter.Write( post);
.... posts UTF-8 encoded text. Every non-US-ASCII characters will take two or
more bytes to encode -- although admittedly at least some of your tests
should have worked.
The url I'm passing in the constructor is http://localhost/QW/spike1.aspx which is the correct url for the page under test. I've tried several different values in the post string, including string.Empty, and always get the same error. The _status property of the request indicates a protocol error, but beyond that I'm not sure how to proceed. Any suggestions as to how I might debug this?
As Steve suggested, try to get Fiddler to work. Or try this sample:
public void PostForm(string url, string formData, string encoding) {
byte[] content = Encoding.GetEnc oding(encoding) .GetByte(formDa ta);
string contentType = String.Format(
"applicatio n/x-www-form-urlencoded; charset={0}", encoding);
HttpWebRequest request = (HttpWebRequest ) WebRequest.Crea te(url);
request.Method = "POST";
request.Content Type = contentType;
request.Content Length = content.Length;
using (Stream requestStream = request.GetRequ estStream()) {
requestStream.W rite(content, 0, content.Length) ;
}
HttpWebResponse response = (HttpWebRespons e) request.GetResp onse();
using (Stream responseStream = response.GetRes ponseStream()) {
byte[] buffer = new byte[response.Conten tLength];
responseStream. Read(buffer, 0, buffer.Length);
// Do something useful with buffer
}
}
Cheers,
--
Joerg Jooss jo*********@gmx .net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: HikksNotAtHome |
last post by:
In Mozilla 1.4b, when the URL is set to a local URL, it works as expected.
function showIt(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "blank.html" ,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.myForm.outputSource.value = xmlhttp.responseText;
}
}
|
by: Bp |
last post by:
I'm writing a simple HTTPRequest that retrieves the content of a web page.
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
httpReq = CType(System.Net.WebRequest.Create(URLString),
System.Net.HttpWebRequest)
httpResp = CType(httpReq.GetResponse(), System.Net.HttpWebResponse)
The problem is that on...
|
by: Roman Gordin |
last post by:
Hi,
I use SVG for web-GUI, but found some serious restrictions 8-(
When I use HTML (dynamically generated from .php), I may use HTTPRequest object to provide dynamically regeneration some part of my HTML (from JavaScript).
But can`t dynamically refresh SVG, becouse SVG support only ECMAScript This old ECMAScript specification do not...
|
by: Daniel Rimmelzwaan |
last post by:
I am having trouble getting the XML out of an HttpRequest object.
I am sending the XML from biztalk into my aspx page, after which I want to
take the XML out of it and process it using a MSXML.DOMDocument. I
understand that in the Request object, it is stored as a binary, and I can't
figure out how to translate it into a text string.
Do I...
|
by: Mark Miller |
last post by:
I just recently started getting the above error on a page I am posting
MULTIPART/FORM-DATA. We have SoftArtisans FileUp component and Filter
installed on the server in question and up until a day or so ago everything
was working fine. I honestly can't remember changing anything since it was
last working. But I tried reinstalling the .Net...
| |
by: Keith Patrick |
last post by:
Could someone explain to me the relationship between these two classes? I
am ripping my hair out trying to divert an HttpRequest to a new location via
an HttpWebRequest, but I cannot get my session xfer to work, possibly due to
the cookies not being compatible. I've spent over a week trying to get the
HWR to integrate nicely with my app, but...
|
by: Gunnar |
last post by:
I am finding some unusual behavior with techniques I am using to
show/hide/update data without having to refresh the page. I'm quite
sure it's developer ignorance on my part and would be grateful for any
suggestions.
My page has 10 tables with their visibility controlled by the user
making a menu selection. For example, selecting menu_1...
|
by: Blaine Manyluk |
last post by:
I have a very unusual request.
I need to be able to generate reports and save them as TIF
files, with full programmatic control. The application will
provide the filenames. Each page of the report will be saved
as a seperate file. All the user should have to do is press a
button to generate the TIFs, without having to "touch the meat"
of...
|
by: Jeff |
last post by:
ASP.NET 2.0
I'm about to program a HttpRequest from my asp.net 2.0 website. I'll request
another server using HttpRequest and ask if password etc are okay....
So I've looked into the HttpRequest constructors and cannot see how to use
it.
public HttpRequest (
string filename,
string url,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |