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 7501903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:41:25+00:00 2026-05-29T20:41:25+00:00

I am working on a Silverlight application that has a Form that is supposed

  • 0

I am working on a Silverlight application that has a Form that is supposed to send the form data to a PHP page with the POST method.

I am using the following code, which is giving me a Security exception. I assumed it to be a cross domain error. I checked the view on localhost as well, but dint work. SOS

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("http://localhost/wb/cam.php", UriKind.Absolute));
                request.Method = "POST";
                // don't miss out this  
                request.ContentType = "application/x-www-form-urlencoded";
                request.BeginGetRequestStream(new AsyncCallback(RequestReady), request);  

    void RequestReady(IAsyncResult asyncResult)  
{

    HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;  
    Stream stream = request.EndGetRequestStream(asyncResult);  

    // Hack for solving multi-threading problem  
    // I think this is a bug  
    this.Dispatcher.BeginInvoke(delegate()  
    {  
        // Send the post variables  
        StreamWriter writer = new StreamWriter(stream);  
        writer.WriteLine("imgdata="+textBox1.Text);  
        writer.Flush();  
        writer.Close();  

        request.BeginGetResponse(new AsyncCallback(ResponseReady), request);  
    });  
}  

// Get the Result  
void ResponseReady(IAsyncResult asyncResult)
{
    try
    {
        HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);

        this.Dispatcher.BeginInvoke(delegate()
        {
            Stream responseStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream);
            // get the result text  
            string result = reader.ReadToEnd();
        });
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}  

private void OnCaptureImageCompleted(object sender, CaptureImageCompletedEventArgs e)
{
            btnSnapshot.IsEnabled = true;
            webCamVRect.Background = new ImageBrush {ImageSource = e.Result};
        }

private void button1_Click(object sender, RoutedEventArgs e)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("http://localhost/wb/cam.php", UriKind.Absolute));
    request.Method = "POST";
    // don't miss out this  
    request.ContentType = "application/x-www-form-urlencoded";
    request.BeginGetRequestStream(new AsyncCallback(RequestReady), request);

}
  • 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-29T20:41:26+00:00Added an answer on May 29, 2026 at 8:41 pm

    You will need to add a clientaccesspolicy.xml to the root of your server that is receiving the request. Also beware of virtual paths as sometimes the the clientaccesspolicy gets put in the virtual path instead of in the root where it should be. Good luck!

    Tim

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

Sidebar

Related Questions

I'm working on a Silverlight 3 application that has to communicate with a PHP
I am currently working on an application that allows reverse geocoding using silverlight +
I'm working on an in-browser Silverlight application that has some fairly compute-intensive operations, e.g.,
I'm working on a Silverlight application that works with WCF services. While loading the
I am working on a C# Silverlight application that needs some text rotated 90
I'm working on a multi-threaded Silverlight application. The application has two threads: Main/UI and
I'm working on a silverlight application that allows users to fill out common forms.
I'm working on a Silverlight 4 application that seems to run fine in IE
I am working on a Silverlight application that uses WCF. I need to have
I'm using a windows phone silverlight application, the default panorama template has a listbox

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.