Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. http://localhost:4567/Test/Callback#state=test&access_token=....
  2.  
  3. http://localhost:4567/Test/Callback
  4.  
  5. var Uri = new Uri("http://localhost:4567/Test/Callback#state=test&access_token=....");
  6.  
  7. // Contains the query
  8. Uri.Fragment
  9.  
  10. #state=test&access_token=....
  11.  
  12. Request.Url.ToString();
  13.  
  14. http://localhost:4567/Test/Callback?state=test&access_token=...
  15.  
  16. var url=@"http://localhost:4567/Test/Callback#state=test";
  17. var uri = new Uri(url);
  18. var result = uri.Fragment;
  19.  
  20. string queryString = Request.Url.Query; // gives you "state=test&access_token=...."
  21.  
  22. string state = Request.QueryString["state"]; // gives you "test"
  23.  
  24. <script language="javascript" type="text/javascript">
  25.  
  26. function JavaScriptFunction() {
  27. document.getElementById('<%= hdnResultValue.ClientID %>').value = document.URL;
  28. }
  29.  
  30. </script>
  31.  
  32. <asp:HiddenField ID="hdnResultValue" Value="0" runat="server" />
  33. <asp:Button ID="Button_Get" runat="server" Text="run" OnClick="Button_Get_Click" OnClientClick="JavaScriptFunction();" />
  34.  
  35. protected void Button_Get_Click(object sender, EventArgs e)
  36. {
  37. string fullURL = hdnResultValue.Value;
  38. string URl = fullURL .Substring(fullURL .IndexOf('#') + 1);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement