I'm sure someone here has run into this problem before: I have a page where I create/execute a HttpWebRequest for another page on the same server, using POST to send serialized data to the requested page in the RequestStream. The problem is that I keep on getting
back my login page, not the page I requested. Now I've tries a few different methods of sending the proper authentication credentials, but nothing seems to be working. This is what I've tried: HttpWebRequest req = ( HttpWebRequest )WebRequest.Create( myURL );
req.Method = "POST";
req.AllowWriteStreamBuffering = true;
// this doesn't work
req.Credentials = new NetworkCredential( userName, passwd );
// neither does this...
string passstring = "userName:passwd";
string auth = "Forms " + Convert.ToBase64String( System.Text.Encoding.ASCII.GetBytes( passstring ));
req.Headers.Add( "Authorization", auth );
// neither does this...
req.Creden ...
Go to the complete details ...