views:

294

answers:

1

I can pass a cookie into my silverlight application from another asp.net page, but i need to add it to the request header of my dataservice... This was easy in ASP.Net, but in Silverlight it seems that i can't manipulate the request header

    private void Authorize()
    {
        Cookie dataServiceAuthCookie = new Cookie(HtmlPage.Document.QueryString["pass"],
                                                  HtmlPage.Document.QueryString["auth"]);
        myDataService_Context.SendingRequest += new EventHandler<SendingRequestEventArgs>(Context_SendingRequest);
    }

    private void Context_SendingRequest(object sender, SendingRequestEventArgs e)
    {
        // what goes here?...

    }
A: 

You can add headers to the request with SendingRequestEventArgs.RequestHeaders:

e.RequestHeaders["key"] = "value";
Ben M