This project is read-only.

401 Unauthorized

Jul 25, 2008 at 8:22 PM
I am getting 401 Unauthorized error from silverlight server.
Although able to login manually to the site and set those information in my web.config.
(I am using VS2008, SL2beta2)


.Net.HttpWebResponse response = request.GetResponse() as HttpWebResponse;
returns error.

I tried another solution :
NetworkCredential userCredential = new NetworkCredential(ACCOUNTID, KEY,;
CredentialCache credentials = new CredentialCache();
credentials.Add(new System.Uri(""), "Basic ", userCredential);
request.Credentials = credentials;

instead of :
byte[] userPass = System.Text.Encoding.Default.GetBytes(ACCOUNTID + ":" + KEY);
string basic = "Basic " + Convert.ToBase64String(userPass);
request.Headers["Authorization"] = basic;

but didnt work.

What am I missing ?