How do I pass the username and password to a httpWebRequest in silverlight 4


How do I pass username and password to an HttpWebRequest in Silverlight 4.

since the HttpWebRequst class in silverlight does not implement Credentials property, therefore i am unable to authenticate my user.

one way I found was, to pass credentials in header using Authorization header, but it requires ASCII encoded value, which is not supported in Silverlight.

any other alternatives???

Perhaps you should just try it. All http headers are by specification ASCII. Hence the fact that HttpWebRequest supports a Headers collection that accepts a string for a header value implies that the string will be converted appropriately when sent in a HTTP session.