im building an app that after the the user logs in to my web site the app goes to a link to get his user name so i will recognize him on the app.
Now if i as a user login from a browser and then paste the like on that browser i will get a page with my username but if i do a web request from code i get an empty page.
My question is how to open the url as a browser or how can i get the value of the cookie on a certin browser
i have tryied
string s= GetHtmlPage("http://www.somedomain.com/account/show_cookies.php","Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)");
static string GetHtmlPage(string strURL,string browser)
{
String strResult;
System.Net.WebResponse objResponse;
System.Net.WebRequest objRequest = System.Net.HttpWebRequest.Create(strURL);
((System.Net.HttpWebRequest)objRequest).UserAgent =browser;
objResponse = objRequest.GetResponse();
using (System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
sr.Close();
}
return strResult;
}
But that also return a blank page.