Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Testing library for .aspx page in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giulio Petrucci - 27 Aug 2007 09:47 GMT
Hi there,

I'm quite new to such this kind of things (i.e. ASPX, web programming
and so on) so don't mind if my question might sound a bit "stupid"...

I need to build a test suit for an .aspx page. The aim of the test is
the following: having some strings like:
"variable=comma_separated_list_of_values", I should send them to my
.aspx page as query string of GET request AND as payload data of POST
requests too. When I use the GET requests I don't have any problem,
using POST I'm experiencing some troubles instead. The code I use is the
following:

Uri uri = new Uri(...ilmiouri...);
HttpWebRequest r = (HttpWebRequest)WebRequest.Create(uri);
byte[] bytes = Encoding.UTF8.GetBytes(data);
r.ContentType = "text/html; charset=utf-8";
r.ContentLength = bytes.Length;
Stream s = r.GetRequestStream(); //Here comes my exception...
s.Write(bytes, 0, bytes.Length);
s.Close();
HttpWebResponse response = (HttpWebResponse)r.GetResponse();

at line "Stream s = r.GetRequestStream()" I have:

System.Net.ProtocolViolationException
Cannot send a content-body with this verb-type.
   at System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream)
   at System.Net.HttpWebRequest.GetRequestStream()
   at CodFis.Test.Request.Send(String method, String data) in
C:\Documents and Settings\blablabla...

Can anyone help me to solve these problems or suggest me an alternative
approach to perform such these tests?

Thanks in advance.
Have a nice day/week,
Giulio - Italia

--
OnAir: Pain of Salvation - "Fandango"
Mr. Arnold - 27 Aug 2007 12:39 GMT
<snipped>

> Can anyone help me to solve these problems or suggest me an alternative
> approach to perform such these tests?

You might want to post to MS.Public.dotnet.framework.aspnet.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.