Form Upload Test Utility?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone know of any form upload utilities which will allow me to upload
files to an ASP.NET page without the need of a web browser?

I like to test a form upload page I wrote (no GUI, it only accepts a form
post).

Thanks!
 
uh can't you script that? I mean I think that I could do it with the
ITC or something ridiculous.. but of course.. using serverXmlHttp might
be needed... I'm pretty sure.

or.. shit.. what's the name of that website?

www.winsockvb.com - oh damn it's down.. i'd go to archive.org and type
in winsockvb.com
or this has some alternatives
http://www.vbforums.com/showthread.php?referrerid=61394&t=407216

I mean.. what I want.. is to build something like XML webservices.. but
based on CSV and a header file or something.. lol

how many instances you trying to run, dog?

-Aaron
 
You can use the HttpWebRequest class.

use something like this (from my memory) :

HttpWebRequest req =
(HttpWebRequest)WebRequest.CreateDefault(http://youpage);

Stream s = req.GetResquestStream();

byte[] post = Encoding.ASCII.GetBytes(string.format(
"yourpostvar={0}&yourotherpostvar={1}",
HttpUtility.UrlEncode("The value of your post variable"),
5.ToString()
);

s.Write(raw, 0, raw.Length);
s.Close();

HttpWebResponse resp = req.GetResponse();

Stream respStream = resp.GetResponseStream();

StreamReader sr = new StreamReader(respStream);

return sr.ReadToEnd();


Notice the post variables are string in ASCII encoding. If you require
passing value that are strings, you will have to deal with string
convertion. Use classic .ToString() and .Parse() methods for simple types,
and Convert.ToBase64String() and Convert.FromBase64String() to handle byte
array (which can for example a byte representation of a serialized object in
binary format, or even xml format).
The other issue I met concerned the international chars like éàç. I needed
to encode it into a byte array then passing it in base 64 form, even if the
type was in string format (but there's certainly better ways).

Hope that helps
Steve
 
You can use the HttpWebRequest class.

use something like this (from my memory) :

HttpWebRequest req =
(HttpWebRequest)WebRequest.CreateDefault(http://youpage);

Stream s = req.GetResquestStream();

byte[] post = Encoding.ASCII.GetBytes(string.format(
"yourpostvar={0}&yourotherpostvar={1}",
HttpUtility.UrlEncode("The value of your post variable"),
5.ToString()
);

s.Write(raw, 0, raw.Length);
s.Close();

HttpWebResponse resp = req.GetResponse();

Stream respStream = resp.GetResponseStream();

StreamReader sr = new StreamReader(respStream);

return sr.ReadToEnd();

Thanks!

I found an easier way - I just whipped up a HTML page and made the form
post directly to my ASPX test page.

Duh - don't know why I didn't think of that in the first place :-)
 
Back
Top