My environment is as follows:
IIS 6.0, Asp.Net 2.0, Windows 2003 Server.
I am trying to create a single sign on SSO environment with C# and log into
a site that is running Apache Server using basic authentication.
Questions:
1. How do I display the response in a new window?
2. Is my code correct for basic authentication?
Here's my code
NetworkCredential myCred = new NetworkCredential("username",
"password");
CredentialCache MyCrendentialCache = new CredentialCache();
MyCrendentialCache.Add(new Uri("url"), "Basic", myCred);
HttpWRequest.Credentials = MyCrendentialCache;
HttpWRequest.PreAuthenticate = true;
HttpWRequest.UserAgent = "CSharp HTTP Sample";
HttpWRequest.KeepAlive = true;
HttpWRequest.Headers.Set("Pragma", "no-cache");
HttpWRequest.Headers.Add("AUTH_USER", "username");
HttpWRequest.Headers.Add("AUTH_PASSWORD", "password");
HttpWRequest.AllowAutoRedirect = true;
HttpWRequest.Timeout = 300000;
HttpWRequest.Method = "Get";
HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();
StreamReader sr = new StreamReader(HttpWResponse.GetResponseStream(),
Encoding.ASCII);
string s = sr.ReadToEnd();
sr.Close();
Response.Redirect(HttpWResponse.ResponseUri.ToStri ng());
thanks in advance.