I'm using this code to login to website via POST request:
HttpWebRequest httpWReq =
(HttpWebRequest)WebRequest.Create(@"http:\\domain.com\page.asp");
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "username=user";
postData += "&password=pass";
byte[] data = encoding.GetBytes(postData);
httpWReq.Method = "POST";
httpWReq.ContentType = "application/x-www-form-urlencoded";
httpWReq.ContentLength = data.Length;
using (Stream stream = httpWReq.GetRequestStream())
{
stream.Write(data,0,data.Length);
}
HttpWebResponse response = (HttpWebResponse)HttpWReq.GetResponse();
string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Create HTTP post request and receive response using C# console application
It works fine, I get html string in response telling me that i'm loged in. But now I would like to for example get my profile data under different url. For example im login with "wwww.mywebsite.com/login" and second url is "www.mywebsite.com/myprofile". Am I able to get content from that second url? of course I can see this profile data only after login.