Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elegant way parsing URL

Tags:

c#

parsing

After POST/GET request I get such URL back which I need to parse, of course I can go and use spit() to get required information, but for sure should be more elegant way of doing that. Any ideas?

http://api.vkontakte.ru/blank.html#access_token=8860213c0a392ba0971fb35bdfb0z605d459a9dcf9d2208ab60e714c3367681c6d091aa12a3fdd31a4872&expires_in=86400&user_id=34558123

I am parsing for: access token and expires_in

like image 812
Bill Gates Avatar asked Mar 30 '13 00:03

Bill Gates


People also ask

What is parsing URL?

URL parsing is a function of traffic management and load-balancing products that scan URLs to determine how to forward traffic across different links or into different servers. A URL includes a protocol identifier (http, for Web traffic) and a resource name, such as www.microsoft.com.

How parse URL in HTML?

Method 1: In this method, we will use createElement() method to create a HTML element, anchor tag and then use it for parsing the given URL. Method 2: In this method we will use URL() to create a new URL object and then use it for parsing the provided URL.


1 Answers

Using the URI class you can do this:

var url = new Uri("your url"); 
like image 192
ryudice Avatar answered Sep 21 '22 16:09

ryudice