title: Unauthorizedaccessexception{"Invalid cross-thread access."}...is occur
body: <p>i want to short my url with bitly but an exception is occur when i want to set out string to my text block</p>
  
  <pre><code>    private void button1_Click(object sender, RoutedEventArgs e)
      {
          ShortenUrl(textBox1.Text);
      }
      enum Format
      {
          XML,
          JSON,
          TXT
      }
  
      enum Domain
      {
          BITLY,
          JMP
      }
  
      void ShortenUrl(string longURL)
      {
          Format format = Format.XML;
       Domain   domain = Domain.BITLY;
          string _domain;
          //string output;
  
          // Build the domain string depending on the selected domain type
          if (domain == Domain.BITLY)
              _domain = "bit.ly";
          else
              _domain = "j.mp";
  
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
              string.Format(@"http://api.bit.ly/v3/shorten?login={0}&amp;apiKey={1}&amp;longUrl={2}&amp;format={3}&amp;domain={4}",
              "username", "appkey", HttpUtility.UrlEncode(longURL), format.ToString().ToLower(), _domain));
  
          request.BeginGetResponse(new AsyncCallback(GetResponse), request);
  
      }
      void GetResponse(IAsyncResult result)
      {
          XDocument doc;
          HttpWebRequest request = (HttpWebRequest)result.AsyncState;
          HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
  
              using (StreamReader reader = new StreamReader(response.GetResponseStream()))
              {
                  string responseString = reader.ReadToEnd();
                  doc = XDocument.Load(reader.BaseStream);
              }
  
              ////  var x = from c in doc.Root.Element("data").Elements()
              //          where c.Name == "url"
              //          select c;
  
              //XElement n = ((IEnumerable&lt;XElement&gt;)x).ElementAt(0);
              //   textBox2.Text = ((IEnumerable&lt;String&gt;)x).ElementAt(0);
  
              lista = (from Born_rich in doc.Descendants("url")
  
                       select new a()
                       {
                           shrtenurl = Born_rich.Value
                       }).ToList();
              output = lista.ElementAt(0).shrtenurl;
              textBox2.Text = output;
  
         //
                  // 
  
  
      //      textBox2.Text = s;
      }
      List&lt;a&gt; lista = new List&lt;a&gt;();
  
  
  
      String output;  
  }
  public class  a
  {
      public String shrtenurl { set; get; }
  }
  </code></pre>