Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4090626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:15:45+00:00 2026-05-20T19:15:45+00:00

I created a simple SL 4 app to connect to Google Analytics but I

  • 0

I created a simple SL 4 app to connect to Google Analytics but I keep getting the following exception:

{System.Security.SecurityException: Security error.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at GoogleAnalytics.Silverlight.MainPage.<>c__DisplayClass4.<GetResponseCallback>b__3()}

I think it has something to do with xss but I’m not sure how to get around that. The following code works fine in a console app but doesn’t in SL.

The UI has a textblock control, here’s the code:

private byte[] _data;

public MainPage()
{
    InitializeComponent();
    this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}

private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    string requestData = "Email=email@gmail.com" +
                         "&Passwd=password" +
                         "&source=Test-App" +
                         "&accountType=GOOGLE" +
                         "&service=analytics";

    _data = Encoding.UTF8.GetBytes(requestData);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://www.google.com/accounts/ClientLogin", UriKind.Absolute));
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.ContentLength = _data.Length;

    request.BeginGetRequestStream(GetRequestStreamCallback, request);
}

private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
{
    this.Dispatcher.BeginInvoke(() =>
    {
        try
        {
            HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
            Stream stream = request.EndGetRequestStream(asynchronousResult);
            stream.Write(_data, 0, _data.Length);
            stream.Close();

            request.BeginGetResponse(GetResponseCallback, request);
        }
        catch (Exception e)
        {
            textBlock.Text = e.ToString();
        }
    });
}

private void GetResponseCallback(IAsyncResult asynchronousResult)
{
    this.Dispatcher.BeginInvoke(() =>
    {
        try
        {
            HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
            HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);

            Stream stream = response.GetResponseStream();
            StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);

            textBlock.Text = streamReader.ReadToEnd().Split(new string[] { "Auth=" }, StringSplitOptions.None)[1];

            streamReader.Close();
            response.Close();
        }
        catch (Exception e)
        {
            textBlock.Text = e.ToString();
        }
    });
}

Update: fixed a typo.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:15:45+00:00Added an answer on May 20, 2026 at 7:15 pm

    Silverlight cannot connect to GA services, I either have to use a service or JavaScript then pass the data to Silverlight.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a very simple app, which presents an easygui entrybox() and continues to
Iam trying to connect my App to a WCF service that I created in
I wish to create a very simple web app that simply displays an Image(s)
I'm trying to add a strongly-typed view to the sample app that's created when
I created a simple .NET windows application in Visual Studio 2005 and on just
I created a simple dialog-based application, and in the default CDialog added three buttons
I've created a simple desktop application in C# 3.0 to learn some C#, wpf
I've created a simple httpModule, registered it on GAC and added it to the
I have created a simple wcf service which used the WCF Service Library template.
I've created a simple user control which is manually created with something like MyUserControl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.