I have an application that tries to access another applications login page that requires username and password variables sent by post. I want to automate this, so as to not make the user login twice. I realize I could write those two variables to hidden fields and then force a submission, but there are is a security liability that the values are left open for any one to see (even if it's for a matter of seconds. Here's the code I have so far, but I don't know how to move the WebResponse that I get to the current response object, so that the user is in a sense "redirected" to the new page.
Code:
string sParams = "username=" + sID + "&password=" + sPassword;
string sUrl = "https://******************.com/index.cfm?view=login&cobrand=*****&lang=en";
System.Net.WebRequest req = System.Net.WebRequest.Create(sUrl);
req.Method = "POST";
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(sParams);
req.ContentLength = bytes.Length;
System.IO.Stream os = req.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
os.Close();
System.Net.WebResponse resp = req.GetResponse();
I get the response, but how do set the current response to the one I generated?
Troubleshooting life: 1 bug at a time.