asp.net application C# with asp.net C# web application
-
I have a an asp.net web application with C# page that sends username and password to an asp.net web application with C# but different application. I need to pass these data to the asp.net we bapplication but without using the Response.Redirect method. I tried to use the HttpWepRequest and HttpWebResponse ways.I use the following code in the source page: string strId = "1"; string strName = "amino"; //string result =""; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = "userid=" + strId; postData += ("&username=" + strName); byte[] data = encoding.GetBytes(postData); // Prepare web request... HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:1644/TragetApp/Default.aspx"); myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; myRequest.AllowAutoRedirect = false; Stream newStream = myRequest.GetRequestStream(); // Send the data. newStream.Write(data, 0, data.Length); newStream.Close(); //Response.End(); //prepare response Stream receiveStream; HttpWebResponse myWebResp = (HttpWebResponse)(myRequest.GetResponse()); receiveStream = myWebResp.GetResponseStream(); //result = sr.ReadToEnd(); receiveStream.Close(); in the page_load of the target page i do the following to c the username: protected void Page_Load(object sender, EventArgs e) { Label1.Text = Request["username"].ToString();//.QueryString["name"].ToString(); Response.Output.WriteLine(Request["username"].ToString()); } I put a break poit in the page_load of the target page. The username is sent correctly to the target page but after i continue running i found that the displayed page is the source page. I need to stop at the target page after receiving the username. What can i do?