How can I SetCookie in Page1.aspx by a System.Net.HttpWebRequest request for Page2.aspx which handle the SetCookie() function?
Page1.aspx and Page2.aspx are in the same webapp.
Page1.aspx:
protected void Page_Load(object sender, EventArgs e)
{
string url = "http://localhost/Page2.aspx";
System.Net.HttpWebRequest myReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
System.Net.HttpWebResponse HttpWResp = (System.Net.HttpWebResponse)myReq.GetResponse();
System.IO.Stream myStream = HttpWResp.GetResponseStream();
}
Page2.aspx:
protected void Page_Load(object sender, EventArgs e)
{
string userName = "Lily";
FormsAuthentication.SetAuthCookie(userName, true);
}