title: Error using facebook C# sdk with WPF web browser
body: <p>I am new to facebook c# sdk. I followed the tutorial in <a href="http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-First-Facebook-Application-v6.aspx" rel="nofollow">this link</a>.</p>
  
  <p>I created an application that displays the user name after log in. Here is my code:</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      private string appId = "appid";
      private string extenededPermissions = "offline_access,publish_stream";
      private Uri loginUrl = null;
      private string accessToken = null;
      private string userName = null;
  
      public MainWindow()
      {
          InitializeComponent();
      }
  
      /// &lt;summary&gt;
      /// Function to get the login url
      /// with the requested permissions
      /// &lt;/summary&gt;
      private void GetLoginUrl()
      {
          dynamic parameters = new ExpandoObject();
          // add the client id
          parameters.client_id = appId;
          // add the redirect uri
          parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html";
          // requested response
          parameters.response_type = "token";
          // type of display
          parameters.display = "popup";
          // If extended permissions are present
          if (!string.IsNullOrWhiteSpace(extenededPermissions))
              parameters.scope = extenededPermissions;
          // Create the login url
          Facebook fc = new FacebookClient();
          loginUrl = fc.GetLoginUrl(parameters);
      }
  
      private void WindowLoaded(object sender, RoutedEventArgs e)
      {
          // get the login url
          GetLoginUrl();
          // Navigate to that page
          webBrowser.Navigate(loginUrl);
      }
  
      private void webBrowser_Navigated(object sender, NavigationEventArgs e)
      {
          var fc = new FacebookClient();
          FacebookOAuthResult fr;
          // Check the returned url
          if (fc.TryParseOAuthCallbackUrl(e.Uri, out fr))
          {
              // check if authentication is success or not
              if (fr.IsSuccess)
              {
                  getUserName(out userName);
              }
              else
              {
                  var errorDes = fr.ErrorDescription;
                  var errorReason = fr.ErrorReason;
              }
          }
          else
          {
  
          }
      }
      private void getUserName(out string name)
      {
          var fb = new FacebookClient(accessToken);
          // Get the user details
          dynamic result = fb.Get("me");
          // Get the user name
          name = result.name;
          MessageBox.Show("Hai " + name + ",Welcome to my App");
      }
  
  }
  </code></pre>
  
  <p>My Problem is with the <code>FacebookOAuthResult</code>.</p>
  
  <pre><code>    private void webBrowser_Navigated(object sender, NavigationEventArgs e)
      {
          var fc = new FacebookClient();
          FacebookOAuthResult fr;
          // Check the returned url
          if (fc.TryParseOAuthCallbackUrl(e.Uri, out fr))
          {
              // check if authentication is success or not
              if (fr.IsSuccess)
              {
                  getUserName(out userName);
              }
              else
              {
                  var errorDes = fr.ErrorDescription;
                  var errorReason = fr.ErrorReason;
              }
          }
          else
          {
  
          }
      }
  </code></pre>
  
  <p>After I logged in it is redirecting to <code>redirect_uri</code>. But the <code>fc.TryParseOAuthCallbackUrl(e.Uri, out fr)</code> fails though the webbrowser redirects to the Authentication successful page.</p>
  
  <p>So I couldn't get the access token. What could the problem in my code be?</p>