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 have created a simple web app/form using google app engine. the site is
I've created a simple iPhone app which has two .xib files. In the app
Hy guys. I've created a simple blog app with the usual CRUD actions. I've
I have created a small and simple android app. I tried installing it on
A simple socket app in Android needs some special permissions to connect through the
I am trying to write a simple Google App Engine website that reads an
I've created a simple Lightswitch 2-tier desktop app that connects to a remote sql
Iam trying to connect my App to a WCF service that I created in
I have a simple self hosted WCF Console windows app, and I can connect
I created sample rails app and deployed into heroku. Rails version is 3.1.3 Ruby

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.