User-663248805 posted
Well I am trying to log in to a form authentication page.
ok i successfuly loged in and it work.
Now the problem is i can not send the second request to that page to click on a link in logged in page.
Do i need to create another reuqest for it or can i use the old one?
here is the error i get:
Cannot send a content-body with this verb-type.
here is my code.
private
void button2_Click(object sender,
RoutedEventArgs e)
{
string loginurl =
"http://localhost/login.aspx";
HttpWebRequest myreq = (HttpWebRequest)WebRequest.Create(loginurl);
string postData =
"some data for login in";
string ClickButton =
"click the button on logged in page";
CookieContainer cookie =
new
CookieContainer();
myreq.CookieContainer = cookie;
myreq.ContentType = "application/x-www-form-urlencoded";
myreq.Method =
WebRequestMethods.Http.Post;
// Send the login information to server
byte[] bytearray =
Encoding.UTF8.GetBytes(postData);Stream
datastream = myreq.GetRequestStream();
datastream.Write(bytearray, 0, bytearray.Length);
datastream.Close();
// Send the order to click a button on logged in page
byte[] bytearray1 =
Encoding.UTF8.GetBytes(ClickButton);Stream
datastream1 = myreq.GetRequestStream();
datastream1.Write(bytearray1, 0, bytearray1.Length);
datastream1.Close();
HttpWebResponse wr = (HttpWebResponse)myreq.GetResponse();
}