Send data to webpage on another website request is made successful but time of retrieval at page load event of destination website webpage it is not preserving data ..i am using following example
[1] Link button on page from where i try to transfer a data to destination website page.
protected void LinkButton1_Click(object sender, EventArgs e)
{
// START Code to pass User related Information on to server using POST method.
string url = "http://localhost:5934/Login.aspx";
string UserName = "Satish.thummar@gmail.com";
string UserID = "592334C3-D836-441E-96B4-15F242D34F15";
ASCIIEncoding encoding = new ASCIIEncoding();
string data = string.Format("UserNameFromPMS={0}&UserIDFromPMS={1}", UserName, UserID);
byte[] bytes = encoding.GetBytes(data);
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.ContentType = "application/x-www-form-urlencoded";
httpRequest.ContentLength = bytes.Length;
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
Response.Redirect("http://localhost:5934/Login.aspx",true );
// END Code to pass User related Information on to server using POST method.
}
[2] Destination website page where i am trying to retrieve a data and use it for more operation but not preserve it menas it is not ASSIGN TO ANY SERVER CONTROL PROPERTY AND NOT EVEN TO VIEW STATE.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
NameValueCollection nvc = Request.Form;
//string userName;
if (!string.IsNullOrEmpty(nvc["UserNameFromPMS"]) && !string.IsNullOrEmpty(nvc["UserIDFromPMS"]))
{
if (!string.IsNullOrEmpty(nvc["UserNameFromPMS"]))
{
//userName = nvc["UserNameFromPMS"];
txtUsername.Text = nvc["UserNameFromPMS"].ToString();
}
if (!string.IsNullOrEmpty(nvc["UserIDFromPMS"]))
{
DataSet dsForPassWord = UserBLL.GetAllByWithDataSet(BusinessLogic.Configuration.DTO.User.UserFields.UsearID, nvc["UserIDFromPMS"]);
if (dsForPassWord != null && dsForPassWord.Tables.Count > 0 && dsForPassWord.Tables[0].Rows.Count > 0)
{
txtPassword.Text = dsForPassWord.Tables[0].Rows[0]["Password"].ToString();
}
//password = nvc["UserIDFromPMS"];
}
btnLogin_OnClick(sender, e);
}
}
}
SO WHAT IS THE SOLUTION ? TO PRESERVE DATA AND USE IT FOR MORE OPERATION ...