Hi,
While trying to access a document on my server through my C# application ,it
says "Remote Server returned and Error : 401 Unauthorised" but when i access
it thro Internet Explorer it works fine.
I've used CredentialCache object and i've also tried "Authrorization " header
with Base64 algo.
string uidpwd = "abhimanyu:siro hi";
byte[] bytes = new byte[uidpwd.Length];
bytes = Encoding.UTF8.G etBytes(uidpwd) ;
WebResponse requestResponse = null;
CredentialCache MyCredentialCac he = new CredentialCache ();
MyCredentialCac he.Add(new Uri("PATH"), "NTLM", new
NetworkCredenti al("username", "password") );
HttpWebRequest Request = (HttpWebRequest ) HttpWebRequest. Create("PATH");
Request.Credent ials = MyCredentialCac he;
Request.Method = "GET";
Request.Headers .Add("Translate ", "F");
Request.Headers .Add("Authoriza tion", "NTLM " + Convert.ToBase6 4String(bytes)) ;
requestResponse = Request.GetResp onse();
plz help
regards
While trying to access a document on my server through my C# application ,it
says "Remote Server returned and Error : 401 Unauthorised" but when i access
it thro Internet Explorer it works fine.
I've used CredentialCache object and i've also tried "Authrorization " header
with Base64 algo.
string uidpwd = "abhimanyu:siro hi";
byte[] bytes = new byte[uidpwd.Length];
bytes = Encoding.UTF8.G etBytes(uidpwd) ;
WebResponse requestResponse = null;
CredentialCache MyCredentialCac he = new CredentialCache ();
MyCredentialCac he.Add(new Uri("PATH"), "NTLM", new
NetworkCredenti al("username", "password") );
HttpWebRequest Request = (HttpWebRequest ) HttpWebRequest. Create("PATH");
Request.Credent ials = MyCredentialCac he;
Request.Method = "GET";
Request.Headers .Add("Translate ", "F");
Request.Headers .Add("Authoriza tion", "NTLM " + Convert.ToBase6 4String(bytes)) ;
requestResponse = Request.GetResp onse();
plz help
regards