title: How to get userID from login on webbrowser c# for windows phone?
body: <p>I am trying to retrieve the UserID that is returned once I have entered and submitted correct username and password. </p>
  
  <p>I have been struggling to:</p>
  
  <ol>
  <li><p>Close the Web-browser once it has successfully logged in. (it just redirects to a page with the UserID and has URL with user id in the end.</p></li>
  <li><p>Retrieve the UserID once logged in.</p></li>
  </ol>
  
  <p>I have tried this to retrieve the user id with no success.</p>
  
  <pre><code>        OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs ex)
                  {
                  base.OnNavigatedTo(ex); 
                  IDictionary&lt;string, string&gt; parameters = NavigationContext.QueryString;      //once the login is successful this piece of code should be 
                   if (parameters.ContainsKey("id"))                                          //executed 
                       {
                      string UserId = parameters["id"];
                      }
                  }
  </code></pre>
  
  <p>I have then tried the below. I get the current URL and not the loaded one. As well as that how can I parse it to just get the user id? </p>
  
  <pre><code>private void webBrowser2_Navigated(object sender, NavigationEventArgs e)
          {
   string URLString = e.Uri.ToString();
             txtURL.Text = URLString;
  </code></pre>
  
  <p>I think I am probably just having problems with the event handler and parsing.</p>
  
  <p>Sorry, I am new to this so please forgive any mistakes I have made. </p>
  
  <p>Thanks.</p>